...

View Full Version : C# - Can this be done?



crank01
01-13-2012, 05:39 PM
I am looking to create an If statement, however I am having difficulty starting it :confused: Now I know IF statements need the use of integers inside the parenthesis correct? However I am trying to create something like so:
public pictureRevealer()
{
if (toolStripButton1_Clicked && toolStripMenuItem1_Clicked)
{
this.pictureBox1.Visible = true;
}
}

Am I far off on accomplishing this, or way way off? Do I need to set a boolean value for toolStripButton1 and use
if (toolStripButton1 == true)
{
this.pictureBox1.Visible = true;
}

then do the same for toolStripMenuItem1? Please give me any ideas :o

alykins
01-13-2012, 10:44 PM
see if this works... (also is this an aspx page or windows form? i am assuming for now it is an aspx page- if form copy idea and apply as necessary


class demo{
private bool btnOneClicked;
private bool btnTwoClicked;
onpageload(){
if(!ispostback){
btnOneClicked=false;
btnTwoClicked=false;
}
pictureRevealer()
}

protected void btnOne_Click(){
btnOneClicked=true;
}
protected void btnTwo_Click(){
btnTwoClicked=true;
}

public pictureRevealer(){
if(btnOneClicked == true && btnTwoClicked == true)
pictureboxOne.Visibile = true;
}
}

could also get fancy with the "if" statement...


pictureboxOne.Visible = (btnOneClicked == true && btnTwoClicked == true)? true : false;

Note: the syntaxes are not all correct- I am doing this as I am walking out the door and for that I apologize (and along with that it is kinda sloppy) but I can check periodically over the weekend and see if you are having difficulty

crank01
01-14-2012, 04:38 AM
ok thanks =) sorry for the slow reply, I was busy the entire day. Let me see if this solved the issue

oh and sorry its a windows form



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum