Groups > Asp .Net > Getting started with ASP.NET > Re: if stmt syntax




if stmt syntax

if stmt syntax
Thu, 3 Apr 2008 14:10:27 +0000
If (ComboBox1.SelectedItem.ToString) = "Abc" &&
(ComboBox5.SelectedItem.ToString) = "Xyz" Then

                TextBox1.Text = "0707781"
            End If 


 

Is the above one right syntax for if statement with 2 conditions..it is giving
me an error..
Post Reply
Re: if stmt syntax
Thu, 3 Apr 2008 14:20:32 +0000
In VB.Net, use "And" instead of "&&".
Post Reply
Re: if stmt syntax
Thu, 3 Apr 2008 14:22:18 +0000
If (ComboBox1.SelectedItem.Text) = "Abc" &&
(ComboBox5.SelectedItem.Text) = "Xyz" Then

                TextBox1.Text = "0707781"
            End If

 You dont need to convert it to ToString as its already a string
Post Reply
about | contact