Overload Functions In A Modual?
Oct 12, 2009if it is possible to overload or override (not sure about the difference) functions in a modual.vb.
View 7 Repliesif it is possible to overload or override (not sure about the difference) functions in a modual.vb.
View 7 RepliesI am trying to pass multiple signature calls to an overloaded function. My understanding is that VB can recognize the different signatures and use the appropriate function.[code]...
View 2 RepliesI want to make the GUI code listing easy to read. I want to inlarge the font. not any control; the listing of the code; not the form window layout; the code listing behind the form and modual listings.
View 2 RepliesWhat I am trying to do is have a class where the functions of the same name are both instance functions and shared functions.
Public Shared Function Get...(byval xx as xx)
and
Public Function Get...
The Public Function uses a Property xx created in the constructor, whereas the Shared Function has the parameters (byval xx as xx).
1) Is it possible to access the Excel mathematical functions without actually opening Excel?
I was thinking of through a DLL WinAPI call or maybe a delegate function or smaller program?
2) Does anyone know of a MS link or area that gives instruction on "how to" use every function of every Windows DLL at all?
Or for all those that Microsoft have chosen to document online at least.
While converting types, I have found myself using both VB functions and BCL Convert.To* methods.
E.g.)
Cstr() vs. Convert.ToString()
CInt() vs. Convert.ToInt32()
CDbl() vs. Convert.ToInt64()
etc...
Are there any subtle differences that should be noted?
Is there a way to see exactly what the functions are doing. What i mean is there a way to see the class? I know what it does, i just want to know the code.
For example the function: Membership.FindUsersByName()
What I am doing is generic and has been done a thousand times, but I can't figure out how other programmers do this.
I am working with the Law of Sines to return an angle of A. There are two combinations, for instance:
Return Angle A given (side b, side a, angle B)
Return Angle A given (side c, side a, angle C)
----Note: All together there would be six, two for each angle)----
I can't overload the functions because the signatures are not unique. The parameters and return type are primitive type Double.
The use of Aliases works for reading the code but does nothing to resolve my issue.
One approach I thought of was to create a structure for each side and angle; however, I don't want to create any more complexity than needed.
Another solution could be using a strategy design pattern?
I've done plenty of Method Overloading, but now I have an instance where I would like to Overload a Property. The IDE in Visual Studio seems to allow it, since I can actually set up the two overloads, but I get an error saying it is not valid because they only differ in type. I think I'm missing something in my syntax?I want to be able to use two (or more) different custom classes as the Type for my property.
Public Overloads Property myFlexibleProperty() As myCustomClass1
Get
Return _myFlexibleProperty1
[code].....
1)When we use Overload constructors in a class
2)and which one is get execut first.
Public Class remoteobj
[Code]...
I'd like to do a kind of overload of the actions in the controller.
Is it possible? 'Cause I havn't found any info about it. And when I tryed, I got this error.
The current request for action 'Create' on controller type 'InterviewController' is >ambiguous between the following action methods:
System.Web.Mvc.ViewResult Create() on type
[Code]....
I've tryed few things to get what I wanted. The last one was to copy what was done in the "Edit" action, but for an empty rank. (so I created an empty rank in my DB). I don't think it was a good idea (imagine someone wants to update the DB where idOpportunite = 5...)
i have this piece of code (which is part of Unolib)
Private Sub Saveonefile(ByRef fl As Sockets.TcpListener)
Dim Client As Sockets.Socket
Dim name As String
Dim buffer(PacketSize - 1) As Byte
[code]....
there are actually 3 errors, but they are all like this one?
I want to have use several versions of the same property within a userControl that inherits a textbox. How can do this if it is possible?I tryed using an object data type insted of the integer and double but it seems like object datatypes carnt be used within a class, because when I tried to use the control the VALUE property was disabled.
'PUBLIC PROPERTIES
Public Property Value() As Integer
Get[code].....
Anyway, I figure my code is all messed up, but I still don't understand this error message.Also, s there a website, that I can get the definitions of the error messages that VB throws out?
Sub Main()
'declaring variables
[code].....
Modifying a program in VB.NET 2003. Need to open a streamwriter object. Here's the trouble line...
Dim objWriter As StreamWriter = New StreamWriter(strHandle).where strHandle is the path and name of a file.
The StreamWriter(strHandle) portion is underlined as an error. The pop up says "Overload resolution failed because no accessible 'New' can be called without a narrowing conversion:"
I recently got a vb book, and the operator overloading sample is quite confusing. understanding why you need to overload an operator, and what's the simplest example?
View 7 RepliesI am having a problem convincing Visual Studio and the compiler to use the correct method overload, possibly because of inheritance.
Given these objects:
Public Class Matrix
...
End Class
[code]....
I want to catch the event of deletion, renaming or copying a file in Windows Explorer. For example, if a folder contains the files "test.a" and "test.b", and that I remove "test.a", then my program will remove the two (same for copy and rename).I know how to add an entry to the context menu of Windows. But the goal isn't to add functionality to Windows. The goal is to redefine an existing function.
View 2 RepliesIs there a way to use CodeDom to generate an overloaded operator in Vb.net? I want to generate this:
Public Shared Operator =(ByVal x As MyType, ByVal y As MyType) As Boolean
Return x Is y
End Operator
The closest hack I can think of to do this the following:
Dim eq As New CodeMemberMethod()
eq.Name = "Operator ="
eq.Parameters.Add(New CodeParameterDeclarationExpression(New CodeTypeReference("MyType"), "x"))[code]....
Which generates this, close but obviously wrong:
Public Shared Function Operator =(ByVal x As MyType, ByVal y As MyType) As Boolean
Return (x Is y)
End Function
I created my own Dictionary class, based on the .NET Dictionary. Now I want to overload then Item() Method. This works fine with the following code: Public Overloads Property Item(ByVal key As TKey) As TValue
[Code]...
I am attempting to use multithreading in one of my VB programs for the first time in attempt to make it more efficient.I have some code that starts the thread but I get an overload resolution error.When initialitzing the thread I am calling a boolean function and not a Sub, but I am not sure if that is the problem.I think the problem may be that the class in which I want the thread to start in has Option Strict Off while the class initalizing is set to Option Strict On.I will post my error and the code which is causing the error. '[code]
View 2 RepliesI use MVC a a programming pattern, in Win apps i simply pass the form to the controller. [code]...
View 2 RepliesI am working on this project and I am suppose to overload the method to allow strings instead of integer. Allow the user optionally add a thried string from a third text box. Okey I am trying to under stand this good. This is the code I have:
This is my overload class
Public Class OverloadEx
[CODE]........................
So with my overload class instead of integer I should put string there? If the user clicks the add button it will allow the user to add all 3 text boxes but when the user click the add string it will allow the user to add all three text boxes to string. So do I click the add string button to overload it to that one just like I did with the add?
I need to overload a method in a windows control does anyone know how to get me started .... oh er missus.
View 2 Repliesi recently stumbled across an error "overload resolution failed because no acceptable fields accepts this number of arguemnets"ive spent an age researching and cannot for the life of me work out what it means, or what exactly the problem is If anyone can enlighten me i would be extremley grateful.
If it helps ive posted part of the code below and highlighted the part which is causing the error in bold
Private Sub UserForm_Initialize(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
[Code]...
Is there anyway to add an overload "extension method" to a method that already has one or more extension methods?For example theString.Contains method has two extension methods totalling 3 separate versions.Is there anyway to add an extra extension method also called "Contains" ?By the way I have tried it but the IDE does not seem to recognise additional EXTENSION methods where a method already hasone or more extension methods.Is there anyway around this restriction?In other words I would like to be able to change the Extension method below from"Contain" to "Contains" but it seems it is not recognised.
Option Strict On
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
[code].....
I'm redoing a program for my company and my boss wanted me to created the entire thing through functions...
For the task I wanted to know is it possible to have functions within functions?
Sort of like in C where we would have nested structures?
Its a FILE I/O, with robot commands, moves and verifications....
So I would find the line in an excel spreadsheet where it moves, the coordinate, put it into an array.
Take the actual results store them into a two dimensional array...etc, etc....
Another function would eventually compare the results with the moves, and within a tolerance.
the Threading.Interlocked class provides; I don't understand, though, why the Add function only offers two overloads: one for Integers, another for Longs. Why not Doubles, or any other numeric type for that matter?Clearly, the intended method for changing a Double is CompareExchange; I am GUESSING this is because modifying a Double is a more complex operation than modifying an Integer.
View 4 RepliesError 4 Overload resolution failed because no accessible 'Where' can be called with these arguments:Extension method 'Public Function Where(predicate As System.Func(Of System.IO.FileInfo, Integer, Boolean)) As System.Collections.Generic.IEnumerable(Of System.IO.FileInfo)' defined in 'System.Linq.Enumerable': Nested function does not have a signature that is compatible with delegate 'System.Func(Of System.IO.FileInfo, Integer, Boolean)'.
Extension method 'Public Function Where(predicate As System.Func(Of System.IO.FileInfo, Boolean)) As System.Collections.Generic.IEnumerable(Of System.IO.FileInfo)' defined in 'System.Linq.Enumerable': 'HasFlag' is not a member of 'System.IO.FileAttributes'.
[code].....
I have an interface that implements the ICloneable interface with the following method declaration Overloads Function Clone() As Object Under this interface is an abstract class "Animal" with:
[Code]....