Page 3 of 3 FirstFirst 123
Results 21 to 28 of 28
  1. #21
    God

    Join Date
    Jul 2013
    Country
    Posts
    243
    Thanked
    107
    Thanks
    101
    Originally Posted by Paul View Post
    This C#/.NET. It's Windows programming, not web based. ;/
    Well I started my developer edu just a month ago. We prob learn this also

  2. #22
    ZAIN's Avatar ʎlǝuol os ɯ,I

    Join Date
    Apr 2013
    Country
    Posts
    475
    Thanked
    83
    Thanks
    314
    int aantaltextBox = Convert.ToInt32(textBox.Text);
    int limiet = Convert.ToInt32(textBox1.Text);
    int aantallabel = Convert.ToInt32(label.Content=0);
    while (aantallabel < limiet)
    {
    label.Content = aantallabel + aantaltextBox;
    }

    i think the problem with this code is that every time you click this button, it resets label to 0. so everytime you click the button, it does label.Content = numTextbox (user input) + numLabel (which is always 0). you only want the label to output 0 once, thats when the program starts.


    label.Content = 0;

    private void method1{
    int numTextbox = Int32.Parse(numBox.Text);
    int limit = Int32.Parse(limitBox.Text);
    int numLabel = int32.Parse(label.Text);

    if (numTextbox <= limit) label.Content = numTextbox + numLabel;
    }

  3. #23
    qais187's Avatar Junior Member

    Join Date
    Nov 2014
    Country
    Posts
    93
    Thanked
    110
    Thanks
    15
    Originally Posted by ZAIN View Post
    int aantaltextBox = Convert.ToInt32(textBox.Text);
    int limiet = Convert.ToInt32(textBox1.Text);
    int aantallabel = Convert.ToInt32(label.Content=0);
    while (aantallabel < limiet)
    {
    label.Content = aantallabel + aantaltextBox;
    }

    i think the problem with this code is that every time you click this button, it resets label to 0. so everytime you click the button, it does label.Content = numTextbox (user input) + numLabel (which is always 0). you only want the label to output 0 once, thats when the program starts.


    label.Content = 0;

    private void method1{
    int numTextbox = Int32.Parse(numBox.Text);
    int limit = Int32.Parse(limitBox.Text);
    int numLabel = int32.Parse(label.Text);

    if (numTextbox <= limit) label.Content = numTextbox + numLabel;
    }
    Ye i know, had already tried it before but it says: "The name 'label.Content' does not exist in the current context" and "The name 'label' does not exist in the current context. And i get a error by 'label.Text' i changed it to 'label.Content' but then i get a different error: "Argument 1: cannot convert from 'object' to 'string' "



    - - - Updated - - -

    Originally Posted by Paul View Post
    It's not that bad, lol. I would choose it over Java. java is just annoying.

    Also, if you're on OS X, why haven't you downloaded Xamarin to test?


    Qais, if it's out of context, usually means one of the following things.

    - Initialize the variable from another class (which you don't have).
    - Make it an instance variable like I did.
    - Declare the variable within' the same function. int firstbox;
    Hmm even when it works, i still need 1 button though.. don't know how i could put that all into 1 button.


  4. #24
    qais187's Avatar Junior Member

    Join Date
    Nov 2014
    Country
    Posts
    93
    Thanked
    110
    Thanks
    15
    Originally Posted by yung View Post
    Java is even worse than C# why are you comparing shit to ebola...~
    C++, C, Rust and the new Swift are the only good programming languges.



    Ok, you're going way too far now, go and google the fkn shit because you don't know anything about C# at all wtf, this can't be your homework you're beyond helpless, if you can't do it on your own why are you asking for spoonfeed here? We've helped you more than enough to fix the problem which you write in the topic, now you want us to do the rest because you can't even use google or do your own homework.

    From topic: "Can someone tell me what i'm doing wrong here? I've looked the net for many hours without luck."

    Took me less than 5 mins to find a decent answer while I have almost 0 knowledge of C#, I learned more in those 5 minutes than you did in "many hours" and apparently even school. Your assignment was to copy a picture of a GUI? Without instructions or an example code to guide you? Or even the teachers example? So much bullshit dude...

    I hope this thread gets closed because you're basically asking for your homework to be done by this forum, but you're pretending there are unsolvable problems in the code, but in reality can be fixed within a minute just by googling.
    You really think i just gonna post some homework in a GAMEFORUM because you think im lazy? I've looked days/hours into this problem without luck. And like i said it a small problem of my hw(see example) i never said do the whole shit because i know the rest. What you did was using 2 buttons to solve(still had errors) it go ahead try to find it while using only 1 then talk. Like i said if you dont want to help i inderstand that but i dont need this shit talking from someone who thinks he all knows whats going on.
    Last edited by qais187; 10-17-2015 at 10:43 AM.


  5. The following user said thank you to qais187 for this useful post:

    Paul (10-17-2015)

  6. #25
    Banned

    Join Date
    Aug 2012
    Country
    Posts
    679
    Thanked
    394
    Thanks
    615
    Just to confirm. It works with two buttons, yes?

  7. #26
    qais187's Avatar Junior Member

    Join Date
    Nov 2014
    Country
    Posts
    93
    Thanked
    110
    Thanks
    15
    Originally Posted by Paul View Post
    Just to confirm. It works with two buttons, yes?
    Dont know will try later(on phone now), ill let u know


  8. #27
    Banned

    Join Date
    Aug 2012
    Country
    Posts
    679
    Thanked
    394
    Thanks
    615
    Well this worked for me.

    Code:
            public void button1_Click(object sender, EventArgs e)
            {
                int firstbox = Int32.Parse( textBox1.Text ); //here you input first value
                int firstvalue = Int32.Parse( textBox1.Text ); // this is to store the first value you write in textbox
                int secondbox = Int32.Parse(textBox1.Text);  //second input!
                int secondvalue = Int32.Parse(textBox1.Text); //this is to store the second value that you input after buttonclick
                int result = firstbox + secondbox; //the sum
                int limitbox = Int32.Parse(textBox2.Text); //limit!
    
                textBox1.Text = ""; //this is so that the textbox clears after the click
    
                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");
                }
    
            }

  9. #28
    qais187's Avatar Junior Member

    Join Date
    Nov 2014
    Country
    Posts
    93
    Thanked
    110
    Thanks
    15
    Originally Posted by Paul View Post
    Well this worked for me.

    Code:
            public void button1_Click(object sender, EventArgs e)
            {
                int firstbox = Int32.Parse( textBox1.Text ); //here you input first value
                int firstvalue = Int32.Parse( textBox1.Text ); // this is to store the first value you write in textbox
                int secondbox = Int32.Parse(textBox1.Text);  //second input!
                int secondvalue = Int32.Parse(textBox1.Text); //this is to store the second value that you input after buttonclick
                int result = firstbox + secondbox; //the sum
                int limitbox = Int32.Parse(textBox2.Text); //limit!
    
                textBox1.Text = ""; //this is so that the textbox clears after the click
    
                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");
                }
    
            }
    YESSS it worked! i changed it a bit. Thank you very much Paul and yes you too yung and the other people for replying and trying to help /request lock
    Code:
     private void button_Click(object sender, RoutedEventArgs e)
            {
                int firstbox = Int32.Parse(textBox1.Text); //here you input first value
                int secondbox = Convert.ToInt32(label.Content);  //second input!            
                int result = firstbox + secondbox; //the sum
                int limitbox = Int32.Parse(textBox2.Text); //limit!
    
                textBox1.Text = ""; //this is so that the textbox clears after the click
    
                if (result <= limitbox)
                { //if you only write < and the MAX is 20, it will give you Invalid because 20 is not less than 20
                    label.Content = result.ToString();
                }
                else
                {
                    MessageBox.Show("Invalid input");
                }
            }
    Last edited by qais187; 10-17-2015 at 11:52 AM.


Page 3 of 3 FirstFirst 123

Thread Information

Users Browsing this Thread

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