I tried to initialize a textbox value by using the .Text
property
Textbox.Text = 0
But Im getting the error Option Strict On disallows implicit conversions from 'Integer' to 'String'.
I tried to initialize a textbox value by using the .Text
property
Textbox.Text = 0
But Im getting the error Option Strict On disallows implicit conversions from 'Integer' to 'String'.
The error message is telling you exactly whats wrong.
Use Textbox.Text = "0"
or don't use Option Strict
.
Both of these will work:
TextBox1.Text = 0.ToString()
TextBox1.Text = CType(0, String)
With option strict on you cannot be ambiguous about your conversions. You need to explicitly state what you are setting values to.
It thinks that TextBox1.Text is a string data type, and that 0 is an integer data type, therefore throwing the error. Convert the 0 to a string before setting them equal.