I'm trying to get this if statement to work. All the other ones work fine except this if statement, which has two jobs. Can some one please help or direct me in the right direction. Should I use a different method or what. Thanks
Sample Code
private void cbSearch_CheckedChanged(object sender, EventArgs e)
{
if (cbSearch.Checked == true)
MainForm.hdSearchdd.Visible = false;
MainForm.hdSearchtxt.Visible = false;
else
MainForm.hdSearchdd.Visible = true;
MainForm.hdSearchtxt.Visible = true;
4 replies to this topic
#1
Posted 12 January 2011 - 11:16 AM
|
|
|
#2
Posted 12 January 2011 - 11:39 AM
Try adding braces to your code:
~ Committed.
private void cbSearch_CheckedChanged(object sender, EventArgs e)
{
if (cbSearch.Checked == true)
{
MainForm.hdSearchdd.Visible = false;
MainForm.hdSearchtxt.Visible = false;
}
else
{
MainForm.hdSearchdd.Visible = true;
MainForm.hdSearchtxt.Visible = true;
}
}Also please encase your code like this: [CODE*]code here[/CODE*] just remove the '*' symbol.~ Committed.
A man can be defined by what he does when no one is looking.
Science is only an educated theory, which we cannot disprove.
Science is only an educated theory, which we cannot disprove.
#3
Posted 12 January 2011 - 12:59 PM
Thank you for you help, been working on this all day.
#4
Posted 12 January 2011 - 11:05 PM
CommittedC0der said:
Try adding braces to your code:
~ Committed.
private void cbSearch_CheckedChanged(object sender, EventArgs e)
{
if (cbSearch.Checked == true)
{
MainForm.hdSearchdd.Visible = false;
MainForm.hdSearchtxt.Visible = false;
}
else
{
MainForm.hdSearchdd.Visible = true;
MainForm.hdSearchtxt.Visible = true;
}
}Also please encase your code like this: [CODE*]code here[/CODE*] just remove the '*' symbol.~ Committed.
thanks for sharing this great info
#5
Posted 15 January 2011 - 07:52 AM
also, in terms of elegant code.. this is redundant
instead, just do this
if (cbSearch.Checked == true) {
instead, just do this
if (cbSearch.Checked) {
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users


Sign In
Create Account


Back to top









