BlueOysterCult Posted October 7, 2003 Posted October 7, 2003 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 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 Quote
*Experts* Volte Posted October 7, 2003 *Experts* Posted October 7, 2003 Replace this:(radMensShoes.Checked = False Or radWomensShoes.Checked = False)with(radMensShoes.Checked = False AndAlso radWomensShoes.Checked = False)Otherwise it will fail unless BOTH checkboxes are checked. Also, you should use OrElse instead of Or in these cases, as it is more efficient. Quote
BlueOysterCult Posted October 7, 2003 Author Posted October 7, 2003 Thank You! It worked- Ya learn something new everday!! I appreciate it Rob Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.