Chidi Okeh
Chidi Okeh

Reputation: 1557

how do I convert textbox value to string?

I know this is simple but i am lost as to how to approach it. Iam a new newbie. Please have it on me as i am new here.

I have a textbox field called ClientsBalance.

This balance can is usually in money order with a set amount. The client is also allowed to pay by Debit Cards.

Here goes:

Dim paymentType As TextBox
otherPyment As String = "Debit Card"

If paymentType.Text <> "1250" Then
  paymentType = "OtherPayment"
else
   paymentType = gridview1.FindControl("paymentType" & CStr(1))
end if

Everything was working before the validation.

Now, I get the following error:

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

Is there a way I can cast this line:

paymentType = "OtherPayment" ??

Thank you so much experts.

Upvotes: 2

Views: 11531

Answers (2)

Kiley Naro
Kiley Naro

Reputation: 1769

Try changing this:

paymentType = "OtherPayment"

To this:

paymentType.Text = "OtherPayment"

Upvotes: 3

nycdan
nycdan

Reputation: 2839

you need to say

paymentType.Text = "OtherPayment".

You just left out the ".Text"

Upvotes: 4

Related Questions