writeline problem

ice_breaker

Registered User.
Local time
Tomorrow, 04:53
Joined
Nov 10, 2008
Messages
20
I have this small program, when I run it and it shows an error as " Conversion from string "firstname: Khoi.firstname" to type 'Integer' is not valid"

Please advise. Thanks
====================
Module Module1

Structure Profile
Dim firstname As String
Dim lastname As String
Dim address As String
Dim dob As Date
End Structure

Sub Main()
Dim Khoi As New Profile()
Khoi.firstname = "Quang Khoi"
Khoi.lastname = "Nguyen Truong"
Khoi.address = "196/16A De Tham"
Khoi.dob = "Sep 20,1982"
WriteLine("firstname:" + " " + "Khoi.firstname")
WriteLine("lastname:" + " " + "Khoi.lastname")
WriteLine("address:" + " " + "Khoi.address")
WriteLine("dob:" + " " + "Khoi.dob")

End Sub

End Module
===================
 
Replace + with &

Sorry for a slow reply because your answer was moved to spam. To be honest, I don't understand your guidance. Can you tell me clear?Thanks
 
WriteLine("firstname:" & " " & "Khoi.firstname")
 
WriteLine("firstname:" & " " & "Khoi.firstname")

It still shows an error "Conversion from string "firstname: Khoi.firstname" to type 'Integer' is not valid" as I have changed as your guidance. Any idea?
 
try

WriteLine("firstname:" & " " & Khoi.firstname.ToString)
 
Another error "Conversion from string "firstname: Quang Khoi" to type 'Integer' is not valid"

I don't declare firstname as integer. I wonder why it always says firstname as integer
 
Another error "Conversion from string "firstname: Quang Khoi" to type 'Integer' is not valid"

I don't declare firstname as integer. I wonder why it always says firstname as integer

Repost the exact line of code that is throwing this error. I suspect you are still attempting to use + in your string concatanation.
 
Sorry for a slow reply. I got a problem with modem. Below is the code:
===========================================
Module Module1

Structure Profile
Dim firstname As String
Dim lastname As String
Dim address As String
Dim DOB As Date
End Structure

Sub Main()
Dim Khoi As New Profile()
Khoi.firstname = "Quang Khoi"
Khoi.lastname = "Nguyen Truong"
Khoi.address = "196/16A De Tham"
Khoi.dob = "Sep 20,1982"
WriteLine("firstname:" & " " & Khoi.firstname.ToString)
WriteLine("lastname:" & " " & Khoi.lastname.ToString)
WriteLine("address:" & " " & Khoi.address.ToString)
WriteLine("dob:" & " " & Khoi.DOB.ToString)

End Sub

End Module
===========================================
Please advise. Thanks
 
Ok, I figured it out.

You are calling: FileSystem.WriteLine(ByVal FileNumber As Integer, ByVal ParamArray Output() As Object)

You need to use the debug class instead.

Try this:

Code:
Debug.WriteLine("firstname:" & " " & Khoi.firstname.ToString)
Debug.WriteLine("lastname:" & " " & Khoi.lastname.ToString)
Debug.WriteLine("address:" & " " & Khoi.address.ToString)
Debug.WriteLine("dob:" & " " & Khoi.DOB.ToString)
 
Can you tell me where i put FileSystem.WriteLine(ByVal FileNumber As Integer, ByVal ParamArray Output() As Object) to prevent error?

The error underslines FileSystem as declaration expected. Pls advise
 
Can you tell me where i put FileSystem.WriteLine(ByVal FileNumber As Integer, ByVal ParamArray Output() As Object) to prevent error?

The error underslines FileSystem as declaration expected. Pls advise

Don't use FileSystem.WriteLine use Debug.WriteLine instead


Replace

Code:
WriteLine("firstname:" & " " & Khoi.firstname.ToString)
WriteLine("lastname:" & " " & Khoi.lastname.ToString)
WriteLine("address:" & " " & Khoi.address.ToString)
WriteLine("dob:" & " " & Khoi.DOB.ToString)

with

Code:
Debug.WriteLine("firstname:" & " " & Khoi.firstname.ToString)
Debug.WriteLine("lastname:" & " " & Khoi.lastname.ToString)
Debug.WriteLine("address:" & " " & Khoi.address.ToString)
Debug.WriteLine("dob:" & " " & Khoi.DOB.ToString)
 
It works dan-cat. Thank you very much for your guidance and your patience to respond to me. Thanks again.

Kinds regards,
Khoi.
 
Thanks to all of you for these useful posts.Its really good to have you intelligent people here.Good job Thanks again..
 

Users who are viewing this thread

Back
Top Bottom