|
-
May 22nd, 2006, 02:32 AM
#1
Thread Starter
Member
[RESOLVED] Type Casting in VB
I got a textbox which will accept a SIZE from the user.
based on this SIZE, i wan to go through a FOR loop SIZE number of times. Do i need to perform type casting to convert the text into integer or can i just use the SIZE as the FOR loop parameter?
Thks
FT
-
May 22nd, 2006, 02:35 AM
#2
Re: Type Casting in VB
It is always a good idea to be explicit.. which means you would use CLng to convert the string to Long and use it in the For loop.
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 22nd, 2006, 02:44 AM
#3
Thread Starter
Member
Re: Type Casting in VB
 Originally Posted by Shuja Ali
It is always a good idea to be explicit.. which means you would use CLng to convert the string to Long and use it in the For loop.
does that mean if i wan to have it as interger i use
Dim charSize As Integer
charSize = CInt(Text4)
How comes it gives me a type mismatch error when i do the above? thks
-
May 22nd, 2006, 02:56 AM
#4
Re: Type Casting in VB
Did you try it like this
VB Code:
Dim charSize As Integer
charSize = CInt(Text4.Text)
Use [code] source code here[/code] tags when you post source code.
My Articles
-
May 22nd, 2006, 03:08 AM
#5
-
May 22nd, 2006, 03:25 AM
#6
Thread Starter
Member
Re: Type Casting in VB
 Originally Posted by bushmobile
what's in your Textbox?
i enter integer values into the textbox..
-
May 22nd, 2006, 03:31 AM
#7
Thread Starter
Member
Re: Type Casting in VB
okies guys, thks alot, everything is working fine now.. i did not used
Dim charSize As Integer
charSize = CInt(Text4.Text)
just now.. thks alot
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|