tags:

views:

14

answers:

2

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'.

+1  A: 

The error message is telling you exactly whats wrong. Use Textbox.Text = "0" or don't use Option Strict.

Alonso
+1  A: 

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.

CowKingDeluxe