|
-
Dec 15th, 2007, 08:04 PM
#1
Thread Starter
Member
[2005] Dynamicaly call overloaded sub or function
As I understand it, overloading allows the appropriate sub/function to be called at run time. Is it possibly to dynammically call a sub based on arguments supplied?
I am working on a console app that accepts command line arguments. The first argument is my app function to be used. Looking at the example below can I call GetRow and pass an array of args, or do I need to determine the number of arguments supplied and then call based on that?
Code:
Sub GetRow(ByVal sheetName As String, ByVal rowNum As Integer, ByVal Blanks As Boolean)
Console.Write("with blanks")
End Sub
Sub GetRow(ByVal sheetName As String, ByVal rowNum As Integer, ByVal sReg As String)
Console.Write("custom s reg")
End Sub
Sub GetRow(ByVal sheetName As String, ByVal rowNum As Integer)
Console.Write("Normal call")
End Sub
"Rightful liberty is unobstructed action according to our will within limits drawn around us by the equal rights of others. I do not add 'within the limits of the law' because law is often but the tyrant's will, and always so when it violates the rights of the individual."
Thomas Jefferson
-
Dec 15th, 2007, 08:30 PM
#2
Re: [2005] Dynamicaly call overloaded sub or function
what you're looking for is the 'optional' keyword
vb Code:
Sub GetRow(ByVal sheetName As String, ByVal rowNum As Integer, optional ByVal Blanks As Boolean, optional ByVal sReg As String)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|