title: VB.Net - Specified Cast is not valid But Debugger showing value
body: <p>The code i am trying to run is a simple one. get text from a <code>Textbox</code> and display that via <code>MsgBox</code>. now i probably have done this a million times but i get a strange error. The Code is :</p>
  
  <pre><code> Dim s As String = FromDateTEX.Text.ToString
   MsgBox(s)
  </code></pre>
  
  <p>I get this error from second line :</p>
  
  <pre><code>System.InvalidCastException: 'Specified cast is not valid.'
  </code></pre>
  
  <p>Here is the strange part : Debugger shows value for <code>s</code> which is correct. here is the screenshot :
   <a href="https://i.stack.imgur.com/mPI3u.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/mPI3u.jpg" alt="screenshot"></a></p>
  
  <p>What am i doing wrong here ?</p>
  
  <p>Edit :</p>
  
  <p>Even this code gets the same error :</p>
  
  <pre><code> MsgBox(“hello”)
  </code></pre>