problem with Optional default data
-
Hi guys. I wanna declare a sub like this:
Private Sub Test( byval val1 as integer, Optional byval val2 as system.object = Me)
but it handle an error like this:Constant expression is required.
i think this error is generated by Me . How i can declare my optional val2 with a form like Me? -
Hi guys. I wanna declare a sub like this:
Private Sub Test( byval val1 as integer, Optional byval val2 as system.object = Me)
but it handle an error like this:Constant expression is required.
i think this error is generated by Me . How i can declare my optional val2 with a form like Me? -
Hi guys. I wanna declare a sub like this:
Private Sub Test( byval val1 as integer, Optional byval val2 as system.object = Me)
but it handle an error like this:Constant expression is required.
i think this error is generated by Me . How i can declare my optional val2 with a form like Me?if u r providing the form name in the last parameter . then u can assign nothing to it as well in the definition part.
-
Hi guys. I wanna declare a sub like this:
Private Sub Test( byval val1 as integer, Optional byval val2 as system.object = Me)
but it handle an error like this:Constant expression is required.
i think this error is generated by Me . How i can declare my optional val2 with a form like Me?Me
cannot be used here. It's an abstract concept that refers to the current instance of the class that it shows up in. You have to replace it with something like this:Private Sub Test(ByVal vl1 As Integer, Optional ByVal val2 As Object = Nothing)
If val2 Is Nothing Then
val2 = Me
End IfA guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007