Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 21st, 2003, 08:11 PM
TripLP TripLP is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 9 TripLP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
String commands

Could someone help me with the command to convert a string into a number, and also if i had a string of say " 29387" if I only wanted 387 is that rtrim, or another command, its been so long

Reply With Quote
  #2  
Old July 21st, 2003, 08:24 PM
nopoints nopoints is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Windsor ON, Canada
Posts: 459 nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level)nopoints User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 13 h 44 m 22 sec
Reputation Power: 8
depends on the type of number you want. try CInt or CLng.

for the second part you could try Right$(" 29387", 3)

Reply With Quote
  #3  
Old July 21st, 2003, 09:52 PM
TripLP TripLP is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 9 TripLP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
thanks

Reply With Quote
  #4  
Old July 22nd, 2003, 02:13 PM
lmck lmck is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 4 lmck User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
You can use the Val command to convert a string to a number:

Val("1234") + 5 'would = 1239

If you want to convert to a specific numeric type, use the conversion functions like;

CInt, CDec, CLng etc.

CInt("12345.6") '=12346 the fraction is rounded up on converting to an int.

Reply With Quote
  #5  
Old July 22nd, 2003, 05:49 PM
TripLP TripLP is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 9 TripLP User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
oh thanks, thats the command i was looking for, lol i was trying value(textbox.text)

Reply With Quote
  #6  
Old December 9th, 2003, 07:07 AM
lucklessproggie lucklessproggie is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Germany
Posts: 7 lucklessproggie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
what about formulas in strings?

Well, what would be a solution when you considering formulas in string. Suppose I have a string "1*2" and need the solution as an integer.. can it be done?
thanks
pete

Reply With Quote
  #7  
Old December 9th, 2003, 08:07 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
guys - look here
__________________
Fisherman

"Any intelligent fool can make things bigger, more complex, and more violent. It takes a touch of genius -- and a lot of courage -- to move in the opposite direction." - A.Einstein

Reply With Quote
  #8  
Old December 9th, 2003, 08:23 AM
Fisherman's Avatar
Fisherman Fisherman is offline
Inherits Programmer.Slacker
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Aug 2003
Location: Between my Id and your Ego
Posts: 2,176 Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level)Fisherman User rank is First Lieutenant (10000 - 20000 Reputation Level) 
Time spent in forums: 1 Week 1 Day 9 h 42 m 4 sec
Reputation Power: 111
Send a message via ICQ to Fisherman Send a message via AIM to Fisherman
took a while, but here is the site for download - add the component to your project, and then you can just do something like this

Code:
Private Sub Form_Load()
Dim strFunction As String
Dim result As Variant

strFunction = "1+6*15"
result = ScriptControl1.Eval(strFunction)
MsgBox result
End Sub

...it really does display 91!

Reply With Quote
  #9  
Old December 9th, 2003, 11:04 AM
lucklessproggie lucklessproggie is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Germany
Posts: 7 lucklessproggie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Good lord! It works!! And to think I racked my brains ripping the expression apart and assigned variables to each number and moved forth! Why, with one component its done! THANKS FISHERMAN!

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > String commands


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway