how to assign variable
-
hi, i have a problem. I am using Visual Basic and is using File System Object. Now after i create a text file, i want to assign variables.. Dim fso As New FileSystemObject Dim fsoStream As TextStream ' Create a text file, and return a reference to a TextStream Set fsoStream = fso.CreateTextFile("c:\junk\junk.txt", True) ' Write to the file fsoStream.WriteLine "First line in the text file." fsoStream.WriteBlankLines 2 fsoStream.WriteLine "Line after two blank lines." fsoStream.Close Set fsoStream = Nothing Set fso = Nothing The letters in bold is the probleam i am having.. i want to assign a variable instead of String text.. Aslo wats the meaning of reading file..i wrote the code but it does nothing Nash Hon
-
hi, i have a problem. I am using Visual Basic and is using File System Object. Now after i create a text file, i want to assign variables.. Dim fso As New FileSystemObject Dim fsoStream As TextStream ' Create a text file, and return a reference to a TextStream Set fsoStream = fso.CreateTextFile("c:\junk\junk.txt", True) ' Write to the file fsoStream.WriteLine "First line in the text file." fsoStream.WriteBlankLines 2 fsoStream.WriteLine "Line after two blank lines." fsoStream.Close Set fsoStream = Nothing Set fso = Nothing The letters in bold is the probleam i am having.. i want to assign a variable instead of String text.. Aslo wats the meaning of reading file..i wrote the code but it does nothing Nash Hon
it depends on what type of variable is. If it is a string then it is pretty straightforward:
Dim abc as String
...
fsoStream.WriteLine abcHowever, if it's some other type, you would have to do some type casting:
Dim abc as Integer
...
fsoStream.WriteLine CStr(abc)Keep in mind however that some variables cannot be type-casted. Hope that helps Notorious SMC
The difference between the almost-right word & the right word is a really large matter - it's the difference between the lightning bug and the Lightning Mark Twain
Get your facts first, and then you can distort them as much as you please Mark Twain