The code i am trying to run is a simple one. get text from a Textbox
and display that via MsgBox
. now i probably have done this a million times but i get a strange error. The Code is :
Dim s As String = FromDateTEX.Text.ToString
MsgBox(s)
I get this error from second line :
System.InvalidCastException: 'Specified cast is not valid.'
Here is the strange part : Debugger shows value for s
which is correct. here is the screenshot :
What am i doing wrong here ?
Edit :
Even this code gets the same error :
MsgBox(“hello”)
Turns out the error was from the above line. LookupEdit
's EditValue
was in fact a Short
and it needed a Convert to Integer
.