Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How can I convert a textbox string into a number preferably single/lon 2

Status
Not open for further replies.

JensKKK

Technical User
May 8, 2007
119
GB
Fairly easy problem I guess.

Here is what I want to do. I want to read information from 4 text boxes (1 string and 3 numbers). If the user did not enter a number then I want to jump to the errorhandler.

What I have done so far is to convert the textbox.text into integer but really want it be single/long because I need numbers bigger than 32000.

Any suggestions are appreciated.

Dim name, As String
Dim start, Number_of_Arrays, Increment, msg, number, replicate, max_arrays, i As Integer
On Error GoTo errorhandler
name = TextBox2.Text
start = Int(TextBox4.Text)
Number_of_Arrays = Int(TextBox3.Text)
Increment = Int(TextBox5.Text)
 
start=clng(TextBox4.text)

_________________
Bob Rashkin
 
BTW "start" is not currently dimensioned as integer - it is a variant - as are all the variables on your second line except i. The "As Integer" phrase must follow each individual variable to declare them explicitly as integers, otherwise they take the default type, which is variant, (unless you have elsewhere used Defint).

Tony
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top