Visual C++ doubt

This is a discussion on Visual C++ doubt within the C++ Programming forums, part of the General Programming Boards category; Hey I am new to the Visual C++ 2005. When working on windows forms how can I accept integer variables ...

  1. #1
    Logic Programmer logicwonder's Avatar
    Join Date
    Nov 2005
    Location
    Kerala, India
    Posts
    52

    Question Visual C++ doubt

    Hey I am new to the Visual C++ 2005.
    When working on windows forms how can I accept integer variables from user entered on a text box and how to display an integer value on a text box?

    Thank You.

  2. #2
    Its hard... But im here swgh's Avatar
    Join Date
    Apr 2005
    Location
    England
    Posts
    1,479
    er, im not sure what you mean.... I have Microsoft Visual C++ 2005 aswell, to acsess and display user integers and then display them you would do this:

    Code:
    #include <iostream>
    
    using namespace std;
    
    int main()
    {
    
    int number;  // declare integer variable to be entered by user
    
    cout << "Please enter a number: ";
    cin >> number;
    
    // display number
    
    cout << "\n\nYou entered the number: " << number << endl;
    
    return 0;
    }
    I am not sure what you mean by text box so i appligise if this is the complete wrong answer
    lol!!

  3. #3
    Logic Programmer logicwonder's Avatar
    Join Date
    Nov 2005
    Location
    Kerala, India
    Posts
    52
    textbox is a form object in Visual C++ .NET programming (similar to the one in Visual Basic).

  4. #4
    Supermassive black hole cboard_member's Avatar
    Join Date
    Jul 2005
    Posts
    1,709
    Surely if you're reading the text from a textbox you can just convert the string to an integer using stringstream?

    Here's a little pseudocode for you (since I don't use Windows forms or 2005):

    Code:
    procedure the_func ()
        number :integer;
        ss :stringstream;
    
        number = ss << textbox.text;
    end;
    Or something... ?
    EDIT: Sorry if this doesn't help, I don't use .NET
    Good class architecture is not like a Swiss Army Knife; it should be more like a well balanced throwing knife.

    - Mike McShaffry

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. We Got _DEBUG Errors
    By Tonto in forum Windows Programming
    Replies: 5
    Last Post: 12-22-2006, 05:45 PM
  2. C++ std routines
    By siavoshkc in forum C++ Programming
    Replies: 33
    Last Post: 07-28-2006, 01:13 AM
  3. load gif into program
    By willc0de4food in forum Windows Programming
    Replies: 14
    Last Post: 01-11-2006, 10:43 AM
  4. Errors with including winsock 2 lib
    By gamingdl'er in forum C++ Programming
    Replies: 3
    Last Post: 12-05-2005, 08:13 PM
  5. Learning OpenGL
    By HQSneaker in forum C++ Programming
    Replies: 7
    Last Post: 08-06-2004, 09:57 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21