Thread: Displaying values of variables to a Form

  1. #1
    Registered User
    Join Date
    Nov 2007
    Posts
    11

    Question Displaying values of variables to a Form

    I'm using Borland C++ Builder 5 and i simply want to be able to have an area on a form that displays the value of a certain variable. should i use a label or something else?

    an example of what i want to do... lets say there are two buttons on my form, button1 and button2. if you click button1, it sets x=10. if you click button2, it sets x=20. there is also an area on the form that is displaying whatever x is currently equal to. so after clicking button1, it will display 10. after clicking button2 the area will display 20.

    Whats the best way to go about doing this?

    thanks

  2. #2
    Registered User
    Join Date
    Dec 2007
    Posts
    385
    You could use a label or ex: a textBox. Im not using Borland but one way to do it for ex button1 should be:
    Code:
    label1->Text = "10";
    or

    Code:
    label1.Text = "10";
    Last edited by Coding; 03-07-2008 at 03:49 AM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. need some advice on displaying values
    By rEtard in forum Windows Programming
    Replies: 7
    Last Post: 06-16-2005, 09:55 AM
  2. Really strange, unexpected values from allocated variables
    By Jaken Veina in forum Windows Programming
    Replies: 6
    Last Post: 04-16-2005, 05:40 PM
  3. Switching byte values between variables
    By Chronom1 in forum C++ Programming
    Replies: 10
    Last Post: 02-23-2005, 12:18 PM
  4. Displaying numerical values in a window
    By drb2k2 in forum C++ Programming
    Replies: 1
    Last Post: 04-08-2003, 12:05 PM
  5. assign values to charechter variables
    By simhap in forum C++ Programming
    Replies: 5
    Last Post: 10-07-2001, 07:55 PM