473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

What's the VB.Net way to do this?

In VB6, I did this: Public Function CallSub(ParamArray VarArg())
How do I do a similar thing in VB.Net?
--
TFWBWY...A
Nov 23 '05 #1
8 2029
"Bryan Dickerson" <tx******@netscape.net> schrieb:
In VB6, I did this: Public Function CallSub(ParamArray VarArg())
How do I do a similar thing in VB.Net?


'ParamArray' is still supported.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>
Nov 23 '05 #2
"Bryan Dickerson" <tx******@netscape.net> wrote in message
news:O2**************@TK2MSFTNGP11.phx.gbl...
In VB6, I did this: Public Function CallSub(ParamArray VarArg())
How do I do a similar thing in VB.Net?
--
TFWBWY...A


fwiw, just ran this through that "wizard"

VB6
'=============
Private Sub MySub(ParamArray VarArg())
Dim i As Integer
For i = 0 To UBound(VarArg)
Debug.Print VarArg(i)
Next
End Sub
'=============

VS05
'=============
Private Sub MySub(ParamArray ByVal VarArg() As Object)
Dim i As Short
For i = 0 To UBound(VarArg)
Debug.Print(VarArg(i))
Next
End Sub

'=============

Now wondering if ParamArray's as useless as it was in VB6 <g> Every time I
considered using ParamArray, I changed my mind (in favor of a real array)
for one reason or another. Especially with VB6 (as opposed to VB5 that
didn't support passing/recv'ing arrays as well as 6)

--
Ken Halter - MS-MVP-VB (visiting from VB6 world) - http://www.vbsight.com
Please keep all discussions in the groups..
Nov 23 '05 #3
Cool!

"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ex**************@TK2MSFTNGP15.phx.gbl...
"Bryan Dickerson" <tx******@netscape.net> schrieb:
In VB6, I did this: Public Function CallSub(ParamArray VarArg())
How do I do a similar thing in VB.Net?


'ParamArray' is still supported.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #4
In order to maintain type safety wouldn't you want to use the new function
overloading features of VB.NET instead of ParamArray?

"Bryan Dickerson" wrote:
In VB6, I did this: Public Function CallSub(ParamArray VarArg())
How do I do a similar thing in VB.Net?
--
TFWBWY...A

Nov 23 '05 #5
"TrtnJohn" <Tr******@discussions.microsoft.com> schrieb:
In order to maintain type safety wouldn't you want to use the new function
overloading features of VB.NET instead of ParamArray?


'ParamArray' doesn't compromise type safety.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #6
The type of each parameter is a variant. (VB 6.0). The compiler cannot
enforce type safety when working with variants.

"Herfried K. Wagner [MVP]" wrote:
"TrtnJohn" <Tr******@discussions.microsoft.com> schrieb:
In order to maintain type safety wouldn't you want to use the new function
overloading features of VB.NET instead of ParamArray?


'ParamArray' doesn't compromise type safety.

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #7
"TrtnJohn" <Tr******@discussions.microsoft.com> schrieb:
The type of each parameter is a variant. (VB 6.0). The compiler cannot
enforce type safety when working with variants.


Yep, but this does not apply to VB.NET. In VB.NET, any type can be used
('ParamArray Foo() As Integer', for example).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 23 '05 #8
"Bryan Dickerson" <tx******@netscape.net> wrote in message
news:O2**************@TK2MSFTNGP11.phx.gbl...
In VB6, I did this:
Public Function CallSub(ParamArray VarArg())
How do I do a similar thing in VB.Net?


Public Function X( ByVal ParamArray Args as Object())
... or ..
Public Function X( ByVal ParamArray Args as String())
... or ..
Public Function X( ByVal ParamArray Args as SomeOtherType())

or, even, all three ... ;-)

HTH,
Phill W.
Nov 23 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Randell D. | last post by:
I have just recompiled, upgraded to PHP 4.3.4. As an exercise (and curiosity) I've decided to test out PDF functions and got the test in the PHP online manual working. I had one problem whereby...
2
by: thecrow | last post by:
Alright, what the hell is going on here? In the following code, I expect the printed result to be: DEBUG: frank's last name is burns. Instead, what I get is: DEBUG: frank's last name is...
220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
699
by: mike420 | last post by:
I think everyone who used Python will agree that its syntax is the best thing going for it. It is very readable and easy for everyone to learn. But, Python does not a have very good macro...
9
by: Martin Maney | last post by:
In my copious spare time I've been dabbling at getting a computerized version of a board game working. After deciding that tk just made me want to vomit, and wx was like swimming through...
92
by: Reed L. O'Brien | last post by:
I see rotor was removed for 2.4 and the docs say use an AES module provided separately... Is there a standard module that works alike or an AES module that works alike but with better encryption?...
3
by: Ron_Adam | last post by:
Ok... it's works! :) So what do you think? Look at the last stacked example, it process the preprocess's first in forward order, then does the postprocess's in reverse order. Which might be...
12
by: Dario | last post by:
The following simple program behaves differently in Windows and Linux . #include <stdexcept> #include <iostream> #include <string> using namespace std; class LogicError : public logic_error {...
30
by: James Conrad StJohn Foreman | last post by:
After 3 years of using DB2 on Linux, I'm leaving my current employers to go work for a SQL Server shop instead. In order to find my replacement, they're trying to put together a set of questions...
2
by: yogesh | last post by:
char TCGI::x2c(char *what) { register char digit; digit = (char) ((what >= 'A' ? ((what & 0xdf) - 'A')+10 : (what - '0'))); digit *= (char) 16; digit += (char) ((what >= 'A' ? ((what & 0xdf) -...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.