Thread: Newbie question, C #

  1. #1
    Registered User
    Join Date
    Dec 2009
    Posts
    1

    Question Newbie question, C #

    Hi.

    Sorry for my bad english. But I was wondering if someome could help me out with an issue with C #. I want to make two textboxes where I can type two numbers. Then press a button and they wil be added togheter. When I make this, something happens wrong. Do I have to convert textboxes to int? How to?

    ex:
    5

    +

    5
    = 55

    I want it to be 5+5=10

    And I also have one more question. If I make a question, (with dropdownlist and a button that says "Next". When pressing this button I want a new question to appear. How to make a new "site" with a new question?

    Thanks for any answers.
    Mate

  2. #2
    Registered User
    Join Date
    Nov 2009
    Posts
    60
    Hello, it's better to post this question in the C # subforum.

  3. #3
    C++ Witch laserlight's Avatar
    Join Date
    Oct 2003
    Location
    Singapore
    Posts
    28,412
    Moved to C# Programming forum.
    Quote Originally Posted by Bjarne Stroustrup (2000-10-14)
    I get maybe two dozen requests for help with some sort of programming or design problem every day. Most have more sense than to send me hundreds of lines of code. If they do, I ask them to find the smallest example that exhibits the problem and send me that. Mostly, they then find the error themselves. "Finding the smallest program that demonstrates the error" is a powerful debugging tool.
    Look up a C++ Reference and learn How To Ask Questions The Smart Way

  4. #4
    Hurry Slowly vart's Avatar
    Join Date
    Oct 2006
    Location
    Rishon LeZion, Israel
    Posts
    6,788
    Code:
                int res = 0;
                Int32.TryParse(this.textBox1.Text, out res);
    All problems in computer science can be solved by another level of indirection,
    except for the problem of too many layers of indirection.
    – David J. Wheeler

  5. #5
    Registered User
    Join Date
    Mar 2009
    Location
    england
    Posts
    209
    Wrong:
    "5" + "5" = "55"

    Right:
    5 + 5 = 10

    The problem you're having is you are adding two strings together, or rather you're joining two strings together.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Stupid Newbie question
    By TimL in forum C++ Programming
    Replies: 4
    Last Post: 07-22-2008, 04:43 AM
  2. C prog newbie question
    By Draginzuzu in forum C Programming
    Replies: 1
    Last Post: 02-03-2003, 06:45 PM
  3. a stupid question from a newbie
    By newcomer in forum C++ Programming
    Replies: 4
    Last Post: 01-11-2003, 04:38 PM
  4. confusion with integers (newbie question)
    By imortal in forum C Programming
    Replies: 7
    Last Post: 12-06-2002, 04:09 PM
  5. newbie class templates question
    By daysleeper in forum C++ Programming
    Replies: 2
    Last Post: 09-18-2001, 09:50 AM