Re: What is wrong with this code?
From: Randy Birch (rgb_removethis_at_mvps.org)
Date: 03/01/04
- Next message: Randy Birch: "Re: Add Information To Saved File String"
- Previous message: nelsonchang_at_tristateww.com: "Delete all worksheets with VB6"
- Maybe in reply to: Larry Serflaten: "Re: What is wrong with this code?"
- Next in thread: Jeff Johnson [MVP: VB]: "Re: What is wrong with this code?"
- Messages sorted by: [ date ] [ thread ]
Date: Sun, 29 Feb 2004 22:30:50 -0500
VB doesn't care and won't complain about sticking an int into a string ...
it's internal data type coercion (often called evil type coercion) will
easily handle this. Going the other way is a different matter.
Private Sub Command1_Click()
Dim x As Long
Dim y As String
x = 12345
y = x
Print x, y
Print TypeName(x), TypeName(y)
End Sub
-- Randy Birch MVP Visual Basic http://vbnet.mvps.org/ Please respond only to the newsgroups so all can benefit. "Steven Burn" <nobody@PVT_it-mate.co.uk> wrote in message news:ul540Ew$DHA.2012@TK2MSFTNGP11.phx.gbl... : xL = integer : lname = string : : Your basically trying to stick an integer into a string, which VB doesn't : like. : : What exactly is your code trying to achieve? : : -- : Regards : : Steven Burn : Ur I.T. Mate Group : www.it-mate.co.uk : : Keeping it FREE! : : Disclaimer: : I know I'm probably wrong, I just like taking part ;o) : : : Jack <replyto@newsgroup> wrote in message : news:#iVHE#v$DHA.1700@TK2MSFTNGP12.phx.gbl... : > In module: : > Public lname As String : > =========== : > In the subroutine the following code causes error on some computers: : > "type mismatch, an unexpected error occured". : > Dim xL As Integer : > xL = Int(Timer) : > lname = Format(xL) : > : > What can be wrong with that? : > : > : :
- Next message: Randy Birch: "Re: Add Information To Saved File String"
- Previous message: nelsonchang_at_tristateww.com: "Delete all worksheets with VB6"
- Maybe in reply to: Larry Serflaten: "Re: What is wrong with this code?"
- Next in thread: Jeff Johnson [MVP: VB]: "Re: What is wrong with this code?"
- Messages sorted by: [ date ] [ thread ]