Vb6 Named Args


Author: Dave
Date: 06.29.15 - 3:33am



every once in a while you encounter a new/old feature of a programming language you never realized was there. I still use a 20 year old language that I have been using for literally 20 years and I did not know about this:

Private Sub Form_Load()
     test b:="i never knew ", c:="vb6 supports named args", a:="wow! "
End Sub


Function test(a As String, b As String, c As String) 'output: wow! i never knew vb6 supports named args Debug.Print a & b & c End Function


It doesn't really matter that you can specify arguments out of order in this exact scenario, where it does come in useful is if you had a function with a lot of optional parameters.. This allows you to only specify the parameters you need, without including a bunch of commas ( an exact number) two hit the specific optional argument that you want.

for such a simple language there is still all kinds of stuff in it that I have not used yet and I still don't know everything about it, and have not used all the types of documents such as ActiveX documents.

here is one other little tidbit i never knew..vb6 will auto convert strings to byte arrays and back. (note they will be unicode translations both ways through to convert to pure ascii still must use strconv)

dim b() as byte 
b = "test"
debug.print chr(b(0)) & " " & b(1) '= t 0
debug.print cstr(b) 'shows test





Comments: (0)

 
Leave Comment:
Name:
Email: (not shown)
Message: (Required)
Math Question: 54 + 64 = ? followed by the letter: C 



About Me
More Blogs
Main Site
Posts: (All)
2024 ( 1 )
2023 ( 9 )
2022 ( 4 )
2021 ( 2 )
2020 ( 4 )
2019 ( 5 )
2018 ( 6 )
2017 ( 6 )
2016 ( 22 )
2015 (15)
     C# self register ocx
     VB6 Class Method Pointers
     Duktape Debug Protocol
     QtScript 4 VB
     Vb6 Named Args
     vb6 Addin Part 2
     VB6 Addin vrs Toolbars
     OpenFile Dialog MultiSelect
     Duktape Example
     DukTape JS
     VB6 Unsigned
     .Net version
     TitleBar Height
     .NET again
     VB6 Self Register OCXs
2014 ( 25 )
2013 ( 4 )
2012 ( 10 )
2011 ( 7 )
2010 ( 11 )
2009 ( 3 )