Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > String-->Int conversion


Reply
 
Thread Tools Display Modes
  #1  
Old 01-15-2004, 10:28 PM
tekno7777's Avatar
tekno7777 tekno7777 is offline
Regular
 
Join Date: Dec 2003
Location: New York, USA
Posts: 91
Default String-->Int conversion


If given a string, "32" for example, what is the function to convert it to an integer?


Thanks,
Tek
Reply With Quote
  #2  
Old 01-15-2004, 10:31 PM
VBJoe's Avatar
VBJoe VBJoe is offline
Village VB Idiot

* Expert *
 
Join Date: Jan 2003
Location: Idaho
Posts: 1,850
Default

Use the CInt function. Make sure to check the string value first to see if it holds a numeric type value.
Code:
Dim s As String, i As Integer s = "32" If IsNumeric(s) Then i = CInt(s)
Reply With Quote
  #3  
Old 01-15-2004, 10:42 PM
tekno7777's Avatar
tekno7777 tekno7777 is offline
Regular
 
Join Date: Dec 2003
Location: New York, USA
Posts: 91
Default nice

Thanks man! Knew it was something like that.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting a file in dat question ? murphys General 5 11-06-2002 08:34 PM
Open an associated Text Document knoxitis General 19 05-01-2002 11:26 PM
Shareware Registry Protection Technigue karachi999 General 2 01-21-2002 02:40 PM
Loop to format file kingesk General 2 09-10-2000 05:01 PM
File format problem kingesk General 1 09-08-2000 04:52 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->