Difference between revisions of "Visual Basic .net"

From ScienceZero
Jump to: navigation, search
m
Line 22: Line 22:
 
Dim f1 As Long<br />
 
Dim f1 As Long<br />
  
f1 = FreeFile()
+
f1 = FreeFile()<br />
 
FileOpen(f1, My.Application.Info.DirectoryPath & "\filename.txt", OpenMode.Output<br />
 
FileOpen(f1, My.Application.Info.DirectoryPath & "\filename.txt", OpenMode.Output<br />
 
Print(f1, "This is line 1")<br />
 
Print(f1, "This is line 1")<br />

Revision as of 08:54, 27 December 2009

Graphics

Files

Reading text files line by line:
Dim f1 As Long
dim filestring as string

f1 = FreeFile() FileOpen(f1, My.Application.Info.DirectoryPath & "\filename.txt", OpenMode.Input)
Do Until EOF(f1)

filestring=LineInput(f1)

Loop
FileClose(f1)
Note: My.Application.Info.DirectoryPath & "\filename.txt" may be replaced by "C:\some_path\file.txt"


Writing text files line by line:
Dim f1 As Long

f1 = FreeFile()
FileOpen(f1, My.Application.Info.DirectoryPath & "\filename.txt", OpenMode.Output
Print(f1, "This is line 1")
Print(f1, "This is line 2")
FileClose(f1)

Arrays

Threading / Parallel

Loops

Conditionals

Math

RS-232