Convert string to textbox

S

Steven K

Hello,

I am having trouble converting a string to a textbox object. I am getting
the following error:

Value of type 'String' cannot be converted to
'System.Web.UI.WebControls.TextBox'.


Dim objUpdate As New TextBox
Dim ctrFor As Integer = 1
Dim strForLoop1 As String = "tbxHandle0" & ctrFor
Dim strFrmObj As String = CType(strForLoop1, TextBox).Text

Thanks, Steven
 
M

Matt Berther

Hello Steven,
Hello,

I am having trouble converting a string to a textbox object. I am
getting the following error:

This is to be expected. A string is not a TextBox.
Dim strFrmObj As String = CType(strForLoop1, TextBox).Text

How about:

Dim objTextBox As New TextBox()
objTextBox.Text = strForLoop1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,792
Messages
2,569,639
Members
45,351
Latest member
RoxiePulli

Latest Threads

Top