|
-
Oct 7th, 2003, 04:35 PM
#1
Thread Starter
New Member
Help?! validating blank fields
Hello All
I am getting used to VB.net - I remember (I think) in VB 6 that if a txtBox.text = "" then it was considered a blank field. I can't get this code to work - I keep getting the message box (error) but I want the ELSE statement to work if it is ( the fields) filled in.
Code
Code:
Private Sub btnOrder_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOrder.Click
If txtName.Text = "" Or cmbBrand.Text = "" Or cmbStyle.Text = "" Or cmbSize.Text = "" _
Or (radMensShoes.Checked = False Or radWomensShoes.Checked = False) Then
MsgBox("Please fill in all fields" & Environment.NewLine & "you may leave width unchecked")
Else
txtBox1.Text = ("Thank You " & txtName.Text & Environment.NewLine & "Men's Shoes:" & radMensShoes.Checked & _
Environment.NewLine & "Women's Shoes:" & radWomensShoes.Checked & Environment.NewLine & "Brand: " & cmbBrand.Text & Environment.NewLine & _
"Style: " & cmbStyle.Text & Environment.NewLine & "Size: " & cmbSize.Text & Environment.NewLine & "Width:" & chbWidth.Checked)
End If
End Sub
Thanks
Rob
-
Oct 7th, 2003, 05:14 PM
#2
Rob,
You find you get a result if you post your VB.Net question in the VB.Net Forum. This Forum is for VB6 
You can find the VB.Net Forum here.
Bruce.
-
Oct 7th, 2003, 07:09 PM
#3
Hyperactive Member
try this:
If trim(TextBox1.text).length = 0 then
' field is blank
else
'field contains data
end if
-
Oct 8th, 2003, 12:14 AM
#4
Addicted Member
Do you mean that you get an error, or does it show the message box that you have there in your code? If you are getting the message box from your code, I would try taking the parentheses from around the "radMensShoes.Checked = False Or radWomensShoes.Checked = False". I don't really see why it would change anything, but it's the only thing that comes to mind.
Take my love
Take my land
Take me where I cannot stand
I don't care, I'm still free
You can't take the sky from me...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|