I have a function called CHECK_DATE
- that allows for a parameter. The CHECK_DATE
function takes the parameter as string and verifies that it's a valid date. What I'm trying to do, on Xing out the form, I ask the user if they want to save the changes - and if they click yes- then I save their changes. What I'm doing is going by the PREFIX and if its txt then I check why type of txt it is, whether textbox of maskedTextbox. If it's masked and date then send it to CHECK_DATE(date)
Dim CTL as Boolean
If TypeOf CTL Is TextBox Then
'do nothing
ElseIf TypeOf CTL Is MaskEdBox Then
if check_Date(ctl???) = true then<-- not sure what to put here.
msgbox "goodDate"
Else
msgbox "Bad date"
End
Public Function CHECK_DATE(CTL as string) as Boolean
'I do my checking here
End Function
Basically I get stuck because I have no idea how to pass the value to the function. On the CHECK_Date
end the parameter is string. But I haven't a clue how to pass it on. When I hoover over typeof CTL it shows me a date but I don't know hwo to pass it as parameter to the function?
Your function must be :
Public Function CHECK_DATE(clt As Control) As Boolean
'I do my checking here
End Function
And you can call it by passing the name of your control in parameter without ".text" like :
CHECK_DATE (Text1)