Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder crank01's Avatar
    Join Date
    Jan 2011
    Posts
    96
    Thanks
    10
    Thanked 2 Times in 2 Posts

    Arrow C# - Can this be done?

    I am looking to create an If statement, however I am having difficulty starting it Now I know IF statements need the use of integers inside the parenthesis correct? However I am trying to create something like so:
    Code:
    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
    Code:
    if (toolStripButton1 == true)
    {
    this.pictureBox1.Visible = true;
    }
    then do the same for toolStripMenuItem1? Please give me any ideas

  • #2
    Senior Coder alykins's Avatar
    Join Date
    Apr 2011
    Posts
    1,721
    Thanks
    41
    Thanked 191 Times in 190 Posts
    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
    Code:
    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...
    Code:
    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

    I code C hash-tag .Net
    Reference: W3C W3CWiki .Net Lib
    Validate: html CSS
    Debug: Chrome FireFox IE

  • Users who have thanked alykins for this post:

    crank01 (01-14-2012)

  • #3
    New Coder crank01's Avatar
    Join Date
    Jan 2011
    Posts
    96
    Thanks
    10
    Thanked 2 Times in 2 Posts
    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
    Last edited by crank01; 01-14-2012 at 03:58 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •