VS 2010 Overloading A Method With Different Outputs?

Aug 2, 2010

i recently discovered a nice feature called overloading, now the question is can i also do that for outputs? for example i want to call a function that would automatically return the datatype i assign the function toright now im geting an error saying "blabla and blabla cant overload eachother because they only differ by return types

View 3 Replies


ADVERTISEMENT

Overloading A Property's Set Method?

May 12, 2012

maybe it's not a method exactly. here's what I'd like to do:

Private _Columns As ArrayList
Public Property Columns() As ArrayList
Get[code]....

which would allow me to conveniently set the property by assigning to it various kinds of collection types... except, I can't do it because apparently the Set method has to take an argument of the type of the property itself... I get the complaint:

'Set' parameter must have the same type as the containing property

is there a way to do this?

View 2 Replies

.net - Method Overloading Getting Wrong Overload?

May 3, 2012

I 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]....

View 2 Replies

C# - Generic Method Overloading Compilation Error In VB?

Aug 5, 2009

I have a problem with the VB.NET compiler failing to compile a class (in a separate C# assembly) which contains two overloads of a method with generic arguments. The equivalent code in C# compiles against the same assembly with no errors. Here are the two method signatures:

protected void SetValue<T>(T newValue, ref T oldValue)
protected void SetValue<T>(T? newValue, ref T? oldValue) where T : struct

Here is the code to three assemblies that demonstrate the problem. The first is the C# assembly with a Base class that implements the generic methods. The second is a C# class derived from Base and calls both overloads of SetValue correctly. The third is a VB class also derived from Base, but fails to compile with the following error message:

[Code]...

Am I doing something wrong in the VB code, or are C# & VB different when it comes to generic overload resolution? If I make the method arguments in Base non-generic then everything compiles correctly, but then I have to implement SetValue for every type that I wish to support.

View 2 Replies

Duplicate Code And Method Overloading / Overriding

May 18, 2012

This is a general question about Object Orientation and specifically overloading functions in .NET (or any other framework or language). I am looking at an application that has a lot of duplicate code. For example, have a look at the following functions: [code] I would of thought that best pratice would be to put: //code that is specifically relevant to Test1 variable in a separate function as it is common in both functions.

View 2 Replies

VS 2010 Overloading Operators For Interfaces

Sep 14, 2011

I have a class that implements an interface. Other objects will get an instance via a method like:

Dim AU1 as IAUC = GetAU(<some GUID>)
Dim AU2 as IAUC = GetAU(<some other GUID>)

What I would like to be able to do is this:If AU1 = AU2..The parts of the class that make up the interface could be equal when the rest of the class is not, and the equality of the interface objects (if you can call them that) is complicated. Several fields have to be compared in odd ways.One option I have is to just add an Equality method to the interface, which would work, but I would rather overload the = and <> operators. As far as I can see, you cannot overload operators as part of an interface, but I was hoping that I had overlooked something.

View 2 Replies

VB 2010 Underscore And Small Rectangles In String Outputs?

Dec 1, 2010

I've made some good progress with my first attempt at a program, but have hit another road block. I'm taking standard output (as a string) froma console CMD window (results of dsquery piped to dsget) and have found small rectangles in the output. I tried using Regex to clean the little bastards but it seems they are related to the _ (underscore), which I need to keep (to return 2000/NT logins). Odd thing is - when I copy the caharcter and paste it into VS2K10 Express it acts like a carrige return?Going to try using /U or /A CMD switch next..

View 2 Replies

VS 2010 Make A Program Which Outputs A Price Of Something Into Currency

Oct 18, 2010

i'v started learning visual basic on a software development college course and i have to make a program which outputs a price of something into currency only when i click on my calculate button it only comes out as a whole number so instead of �1.00 it just says 1, this is my output code.

qty = txtQty.Text
money = 100
If lstItems.SelectedIndex = (0) Then

[Code]......

View 3 Replies

VS 2010 Using 3 Or More Sound Outputs Or Multiple Sound Devices

Jul 21, 2011

I'm creating an application that will have 3 streams of audio. I can get 2 streams playing easy enough using DirectX AudioVideoPlayback and setting the balance for each Audio Instance. However, I need a 3rd Audio instance to play out of another output such as the Rear or Centre. An alternative would be to be able to select a different sound device in the machine to play the 3rd audio stream.

[Code]...

View 1 Replies

VS 2010 What's Equivalent Method In .NET Of Picture1.Scale Method In 6.0

Jun 12, 2011

What's the equivalent method in .NET of the Picture1.Scale (0,0)-(10,10) method in 6.0?

View 2 Replies

VS 2010 Call The Same Method In A Method While Threading?

Jan 29, 2012

I have a Application that Crypts all Files in a Directory and the Subdirectories

Public Shared Sub CryptAllFiles(ByVal crypt As Object)
'check if this dir exists
Dim vDirInfo As New DirectoryInfo(vPath)
If Not vDirInfo.Exists Then Exit Sub
'get all files' sizes in current path

[Code]...

View 3 Replies

Consider Operator Overloading In .net?

Sep 9, 2009

What scenarios would you consider operator overloading in .net?

View 5 Replies

Get An Error Overloading Sub New()

Nov 20, 2009

I have a module with code that refers to controls on form1 form1.textbox1.text 'after adding the sub new overload below to my form my module gives me "reference to a non shared member requires an object reference" why is that? [code]

View 9 Replies

Get An Error Overloading Sub New()?

Jul 28, 2011

passing a variable to another formI have a module with code that refers to controls on form1form1.textbox1.text 'after adding the sub new overload below to my form my module gives me "reference to a non shared member requires an object reference"

View 2 Replies

Function Gives 2 Different Outputs?

Sep 7, 2010

I have a very strange thing going on...I got a lot the CheckErrorStatus (Int32) error...and so I started to dig into my created functions. At the end I found what gave that error and so I added a new breakpoint on both computers where I want to run it (one is the developping computer, the other is the clients computer).

Developping computer : Windows 7, VS2008, .NET Framework 3.5SP1
Clients computer: Windows XP SP3, VS2008, .NET Framework 3.5SP1

the code of the function is a follows:

[Code]...

how it can that with the same input this function gives 2 differents (of which one is fault) output?

View 10 Replies

String - Different Outputs ?

Jul 24, 2010

About the following code:

Dim vDeletedMessageSubject As String = oMessage.subject
oMessage.Delete()
System.Diagnostics.Debug.WriteLine("Message with subject: {0} deleted.",

[CODE]...

Why the different outputs?

dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf'
dp.SyntaxHighlighter.HighlightAll('3ab83152232341d6a1b8a6f4a3419500')

View 3 Replies

Asp.net - Overloading Enums And Properties In .NET?

Sep 23, 2010

I have a base class with the the following enum and property:

[Code]...

First off, how do I do this - is it by simply overloading it? And secondly will my original property pick up the new enum automatically when using the derived class or will I need to overload that too?

View 2 Replies

Overloading Assignment Operator?

Jan 9, 2010

i would like to hijack the assignment operator and do some customization before an instance of my class is assigned.

example:
Dim A as New MyClass
Dim B as MyClass = A

i want custom the behavior of = is that possible?

View 9 Replies

VS 2005 OverLoading Showdialog?

Sep 28, 2011

I wanna overload the ShowDilog for my form. I wanted to clarify whether the Owner should be passed as Value or Reference.

View 2 Replies

Class Structure For Three Outputs?

Feb 20, 2012

Could someone write me a Class structure for passing the data array below.

Function function1(Byval input1 as Double, Byval input2 as Double, Byval input3 as Double)
'code'
data.data1=value1

[code].....

View 4 Replies

Pause In Between Screen Outputs?

Oct 7, 2008

I've got a little code that just reads and displays all the folders in a particular directory. What I want to happen though is for the program to pause 1 second after adding a new folder to the listbox. When I have Sleep(1000) it simply freezes completely.

Code:
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

[code].....

View 4 Replies

.net - Overloading Operators In C++, Exporting And Importing Then In .NET?

Jan 26, 2010

I have a weird situation. I have a C++ code that overloads the +,-,* operators and exports them in a .DLL file. Now, I want to import those overloaded operators from within VB.NET code. So it should be like this:

<DllImport("StructDLL.dll")> Public Shared Function
Operator +(ByVal a1 As A, ByVal a2 As A) As A
End Function

So what I'm trying to do above it just import the lovely overloaded operator + from the DLL.Note that the operator is already overloaded from inside the DLL, so should I import it as a Function or as an Operator like this?

<DllImport("StructDLL.dll")> Public Shared
Operator +(ByVal a1 As A, ByVal a2 As A) As A
End Operator

The overloaded plus operator is supposed to add structs. So the DLL is programmed to work on structs (C++) and I want to import it in VB.NET to work on Structures.

View 1 Replies

Need A Solution To Do Type Parameter Overloading

May 20, 2011

I need type parameter overloading as such:[code..]

so that i can New Map(Of Human) and the compiler will automatically match it to Public Class Map(Of TKey, TValue) and if i new Map(Of String) the compiler will automatically match it to Public Class Map(Of TKey As IEquatable(Of TKey), TValue) (since String is an IEquatable(Of String))

Right now my solution is to give the class different names as such:[code...]

View 2 Replies

Operator Overloading In Getting Some Kind Of Compatibility?

Jul 15, 2010

I'm working together with someone on a project, but I'm writing code in VB.Net, and hes coding in VC++. I'm trying to get some kind of compatability going on, so I'm putting my support classes into a VB dll. I've tested it a little, and it seems that all of the functions work, but the operator overloading that I did in VB doesnt seem to carry over to C++.

View 2 Replies

Overloading Several Functions In Interface File

Nov 12, 2008

I'm trying to overload several functions. These are first defined in an interface:

Code:
Namespace Scripting
Public Interface IGlobalFunctions
Overloads Function InOutBox(ByVal messageBoxText As String) As DialogResult
Overloads Function InOutBox(ByVal messageBoxText As String, ByVal caption As String) As DialogResult
[Code] .....

It complies and runs.. But I can only use the first version of InOutBox when I try to use the next one I get an error telling me: "Wrong number of arguments or invalid property assignment".

View 1 Replies

Create Function With Multiple Outputs?

Dec 8, 2010

Is it possible to create a VB function with multiple outputs. Note: I am not looking for an array containing me three outputs or a variable using delimitters

View 3 Replies

How To Question On Listbox Outputs And Arrays

Jul 11, 2009

I a program that you can store stocks in,such information as name of the stock, price of the stock when you purchased it and so forth.This is stored in a file that is read and can be changed.My button that displays the information is giving me some problems as I have it setup and it will read my original file but when I add files its not going to display the new files.I need a way to make it output to my list box the new files as well as the old ones.right now my listbox outputs 5 lines, and each line has 5 records now the amount of records per line will not change but the number of lines I have will.I cannot pre write lines for something that has not happened, and I am stumped on how to fix this problem..

I am still learning and new to code so for me to write code that writes other code seems like some fantasy out of the terminator so I am sure there are much much simpler ways to do this than that.I am guessing using a loop and a variable in my array than the actual number something a long the lines of csvData(i)However I am just not seeing what syntax to use and how I would go about putting this together... Never came across anythign like this in the past.[code]any thoughts for ways to attack this problem and the type of syntax that would have to be used?

View 1 Replies

Same Project Concepts And Funtions But Different Outputs?!

Sep 12, 2010

I started programming 6 months ago, Visual Basic is kind of easy and I made lots of programs. Now I am confused now. I have a serious problems about DLL's but I didn't made them but I knew how to make use of them. Okay I have 2 programs and one was having a problem and other one has no problem, they have the same framework, same code, but they have problems.url...

View 12 Replies

Something Like Operator Overloading For Only Part Of An Objects Properties?

Aug 21, 2009

For good reasons I would like to have something like truckA = truckB + truckC where only the loads of the trucks are added, not the license plate numbers. Also I don't really want to return a new object (lots of overhead), just change one or two of the properties. Only thing I can come up with is truckA.Load = truckB.Load + truckC.Load, or at best truckA.Load = truckB + truckC which still doesn't look elegant, and - worse - still requires the creation of a new Load object.(this is just a way of stating my problem; the real objects are quite big and complicated) Currently I have a Sub isSumOf so the code reads TruckA.isSumOf(truckB, TruckC)

View 4 Replies

Input A Part Number And It Outputs A Image?

May 12, 2010

I'm doing a school project with arrays and I want it so that I input a part number and it outputs a image, price, and name for the part. I need to accomplish this using the array. We've only ever done arrays where you input a part number and one thing comes back out, not multiple.

View 1 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved