atmosphere1212 Posted October 8, 2004 Posted October 8, 2004 Hey I'm using vb.net and I have a question about opional params. if i have a sub: Public sub doSomething( ..., Optional Byref d1 as Date = Nothing ) ... End Sub I am getting an error saying cannot cast object to date in a constant expression. Why am I getting this? And how do I fix it to set some null default value? Quote
Moderators Robby Posted October 9, 2004 Moderators Posted October 9, 2004 First I would use DateTime instead of Date, second you may want to overload the method and not use the Optional keyword. The OverLoad would solve the problem of the argument being left out. Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.