Vb.net text box
-
Hi, i have wriiten one simple code for value Checking but the code is working for a single digit number for double digit it doesnot work, i dont no why. Please help me reg this. My simple code is
If (txtqty.Text > "2") Then
btn3.Visible = False
btn3.Enabled = False
txtp3.Enabled = False
txtr3.Enabled = False
Else
btn3.Visible = True
btn3.Enabled = True
txtp3.Enabled = True
txtr3.Enabled = True
End If -
Hi, i have wriiten one simple code for value Checking but the code is working for a single digit number for double digit it doesnot work, i dont no why. Please help me reg this. My simple code is
If (txtqty.Text > "2") Then
btn3.Visible = False
btn3.Enabled = False
txtp3.Enabled = False
txtr3.Enabled = False
Else
btn3.Visible = True
btn3.Enabled = True
txtp3.Enabled = True
txtr3.Enabled = True
End IfI would suggest you buy a basic VB book and read it. You're doing a string comparison, and you need instead to convert the string to a number.
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Hi, i have wriiten one simple code for value Checking but the code is working for a single digit number for double digit it doesnot work, i dont no why. Please help me reg this. My simple code is
If (txtqty.Text > "2") Then
btn3.Visible = False
btn3.Enabled = False
txtp3.Enabled = False
txtr3.Enabled = False
Else
btn3.Visible = True
btn3.Enabled = True
txtp3.Enabled = True
txtr3.Enabled = True
End IfSince I'm in a good mood:
if isnumeric(txtqty.text) andalso integer.parse(txtqty.text) > 2 then
'do stuff here
else
'do stuff here
end ifshould do it But take CG's advice and go back to reading a book first, this is very basic stuff
-
Since I'm in a good mood:
if isnumeric(txtqty.text) andalso integer.parse(txtqty.text) > 2 then
'do stuff here
else
'do stuff here
end ifshould do it But take CG's advice and go back to reading a book first, this is very basic stuff
Of course, this code will explode if the user types in anything other than numbers. :-)
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
Of course, this code will explode if the user types in anything other than numbers. :-)
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
:confused: Why? Just tested it and it doesn't Read the code carefully CG. (tip: 'isnumeric') And even if it does a nice explosion now and then isn't that bad ;P
-
Since I'm in a good mood:
if isnumeric(txtqty.text) andalso integer.parse(txtqty.text) > 2 then
'do stuff here
else
'do stuff here
end ifshould do it But take CG's advice and go back to reading a book first, this is very basic stuff
sir, I try this, txtqty as one text box in its text change property i have checked if not is numeric (txtqty.text) then Msg box ( "Please Enter only numeric values") txtqty.setfocus End if After that while Checking the values in Qty Box through a button click with below code, it was not working, Am not a programming professional, because of my own interest am trying to develop some small projects. dont mistaken me,thanks For your help
-
:confused: Why? Just tested it and it doesn't Read the code carefully CG. (tip: 'isnumeric') And even if it does a nice explosion now and then isn't that bad ;P
Ooops - you are right. *blush*
Christian Graus Driven to the arms of OSX by Vista. Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
-
sir, I try this, txtqty as one text box in its text change property i have checked if not is numeric (txtqty.text) then Msg box ( "Please Enter only numeric values") txtqty.setfocus End if After that while Checking the values in Qty Box through a button click with below code, it was not working, Am not a programming professional, because of my own interest am trying to develop some small projects. dont mistaken me,thanks For your help
K so you did the check so now instead of txtqty.text>"2" use integer.parse(txtqty.text) > 2 Your code is comparing a string you can't use that for the > < operators