&& question

G

Guest

Good morning, everyone,

I have a textbox and a radio button and I am trying to run an IF statement
to check on the content of the textbox AND if one of the radio buttons is
checked and everytime I use the && it tells me "Invalid expression term
'&&'". Also, can you tell me what to use to check which property to use to
check which is the selected item in the radio buttons group?

The code I have is

if (txtSearch.Text.Length > 0) && (radSearch.SelectedIndex==0);

Thanks,


Antonio
 
M

Markus

if (txtSearch.Text.Length > 0) && (radSearch.SelectedIndex==0);


wrong brackets:

if (txtSearch.Text.Length > 0 && radSearch.SelectedIndex==0)
{
// do someting here
}

or if you really like many brackets and want to do some extra work ;-) :

if ((txtSearch.Text.Length > 0) && (radSearch.SelectedIndex==0))
{
// do someting here
}


hth
Markus
 
G

Guest

Thank you, Markus!

Antonio

Markus said:
wrong brackets:

if (txtSearch.Text.Length > 0 && radSearch.SelectedIndex==0)
{
// do someting here
}

or if you really like many brackets and want to do some extra work ;-) :

if ((txtSearch.Text.Length > 0) && (radSearch.SelectedIndex==0))
{
// do someting here
}


hth
Markus
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top