Results 1 to 5 of 5

Thread: How to use Textbox values for calculations

  1. #1
    Join Date
    Feb 2008
    Posts
    324

    How to use Textbox values for calculations

    How do you retrieve values in a TextBox to make calculations? If I am not mistaken, if you retrieve a value from a TextBox then these values are characters/string?

  2. #2
    Join Date
    May 2008
    Posts
    3,971

    Re: How to use Textbox values for calculations

    Convert Textbox's value into the integer. I know about C language and in that atoi is expected to do this. However I doubt about your application.

  3. #3
    Join Date
    Feb 2008
    Posts
    324

    Re: How to use Textbox values for calculations

    But when I do:

    Code:
    int x = 3 * (int)TextBox1.Text;
    I have a compilation error "Can not implicitly convert string to int"

    Error 1 Can not convert type 'string' to 'int'

  4. #4
    Join Date
    May 2008
    Posts
    913

    Re: How to use Textbox values for calculations

    I suppose you are using C# which is more like Java. If I am correct than there is a constructor "new Integer (String)" or a static method in class "Integer" that you can use to convert String value to Integer value.

  5. #5
    Join Date
    Feb 2008
    Posts
    324

    Re: How to use Textbox values for calculations

    Hey I got the solution. Thanks sergioKomic, it reminds me this:

    Code:
    int x = Convert.ToInt32 (TextBox1.Text);
    Anyways thanks.

Similar Threads

  1. Replies: 3
    Last Post: 02-01-2012, 10:39 PM
  2. W32 registry values are not getting matched by the default values
    By Angrzej in forum Networking & Security
    Replies: 5
    Last Post: 19-05-2011, 12:23 PM
  3. Replies: 2
    Last Post: 20-08-2010, 01:23 AM
  4. VBScript to get textbox values
    By Jesus2 in forum Software Development
    Replies: 5
    Last Post: 17-12-2009, 06:25 AM
  5. To speed up calculations on a Worksheet
    By Bankebihari in forum Windows Software
    Replies: 3
    Last Post: 10-04-2009, 12:07 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,711,622,077.40120 seconds with 16 queries