Results 1 to 10 of 28

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    yung's Avatar ∅ ≠ S → ∅

    Join Date
    Jan 2011
    Country
    Posts
    834
    Thanked
    233
    Thanks
    118
    Originally Posted by qais187 View Post

    This is the end result i need to get:
    I know how to do the rest, the only thing i don't know is [see thread]. That's all and because i know how to do i haven't worked on the other things only the design is completely done.
    Dude that's way to complicated for you. It's way too early. If you want to store it or something you need to learn a little bit more, just do easy shit like this

    Code:
    public void button1_Click(object sender, RoutedEventArgs e){         
            int firstbox = Convert.ToInt32(textBox1.Text); //here you input first value
            int firstvalue = textBox1.Text; // this is to store the first value you write in textbox
            textBox1.Text=""; //this is so that the textbox clears after the click
    }
    
    
    public void button2_Click(object sender, RoutedEventArgs e){
            int secondbox = Convert.ToInt32(textBox1.Text);  //second input!
            int secondvalue = textBox.Text; //this is to store the second value that you input after buttonclick
            int result = firstvalue + secondvalue; //the sum
            int limitbox = Convert.ToInt32(textBox2.Text); //limit!
            if (result <= limitbox) { //if you only write < and the MAX is 20, it will give you Invalid because 20 is not less than 20
                textBox1.Text=result.tostring();
            }else{
                MessageBox.Show("Invalid input");
            }
    
    
    }
    This is horribly written and I don't even know C#, but you can use this kind of method, you need database knowledge like asp.net or something in order to store a value properly, or maybe something else. Either way I don't see the point of doing something that's way too hard while you barely know the basics, do simpler tasks instead of going for what looks easy but that you have no idea what functions are required.

    But for this program to work you need to make a button for Button1_Click that says "Add" or something, then another one for Button2_Click that says "Result" or something.
    Last edited by yung; 10-16-2015 at 09:32 PM.

  2. #2
    qais187's Avatar Junior Member

    Join Date
    Nov 2014
    Country
    Posts
    93
    Thanked
    110
    Thanks
    15
    Originally Posted by yung View Post
    Dude that's way to complicated for you. It's way too early. If you want to store it or something you need to learn a little bit more, just do easy shit like this

    Code:
    public void button1_Click(object sender, RoutedEventArgs e){         
            int firstbox = Convert.ToInt32(textBox1.Text); //here you input first value
            int firstvalue = textBox1.Text; // this is to store the first value you write in textbox
            textBox1.Text=""; //this is so that the textbox clears after the click
    }
    
    
    public void button2_Click(object sender, RoutedEventArgs e){
            int secondbox = Convert.ToInt32(textBox1.Text);  //second input!
            int secondvalue = textBox.Text; //this is to store the second value that you input after buttonclick
            int result = firstvalue + secondvalue; //the sum
            int limitbox = Convert.ToInt32(textBox2.Text); //limit!
            if (result <= limitbox) { //if you only write < and the MAX is 20, it will give you Invalid because 20 is not less than 20
                textBox1.Text=result.tostring();
            }else{
                MessageBox.Show("Invalid input");
            }
    
    
    }
    This is horribly written and I don't even know C#, but you can use this kind of method, you need database knowledge like asp.net or something in order to store a value properly, or maybe something else. Either way I don't see the point of doing something that's way too hard while you barely know the basics, do simpler tasks instead of going for what looks easy but that you have no idea what functions are required.

    But for this program to work you need to make a button for Button1_Click that says "Add" or something, then another one for Button2_Click that says "Result" or something.
    I get this(tried to put 'firstvalue' also by the 'button1_click1' but that didnt work :
    first error is: Cannot implicitly convert type 'string' to 'int'
    2nd: The name 'textBox' does not exist in the current context
    3rd: The name 'firstvalue' does not exist in the current context


    And yea i know but that's my homework we did not learn it how to do this little part of the homework is research on the internet.. the closest related thing to this is that we learnt to make a calculator.
    Last edited by qais187; 10-16-2015 at 10:09 PM.


Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)