Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Tags Active Topics RSS Search Mark Forums Read

Reply
 
Thread Tools Search this Thread
  #1  
Old 26-11-2008
Member
 
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?
Reply With Quote
  #2  
Old 26-11-2008
Member
 
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.
Reply With Quote
  #3  
Old 26-11-2008
Member
 
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"

Quote:
Error 1 Can not convert type 'string' to 'int'
Reply With Quote
  #4  
Old 26-11-2008
Member
 
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.
Reply With Quote
  #5  
Old 26-11-2008
Member
 
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.
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "How to use Textbox values for calculations"
Thread Thread Starter Forum Replies Last Post
Where does most of the calculations done in the computer take place? Muskil Off Topic Chat 3 02-01-2012 10:39 PM
W32 registry values are not getting matched by the default values Angrzej Networking & Security 5 19-05-2011 12:23 PM
Excel/VBA: Copying text from UserForm Textbox to a Worksheet Textbox Neil Ives Software Development 2 20-08-2010 01:23 AM
VBScript to get textbox values Jesus2 Software Development 5 17-12-2009 06:25 AM
To speed up calculations on a Worksheet Bankebihari Windows Software 3 10-04-2009 12:07 PM


All times are GMT +5.5. The time now is 01:08 AM.