BigCrickNan
Chairman of Selectors
- Joined
- Sep 11, 2005
Wow, thanks for that tut Embi, when are you gonna finish it?
Drewska said:Embi, i'll your tutorial soon as i'm just downloading Visual Basic now, it looks good .
Btw, Colin, where is the start of the tutorial your doing now?
embi said:Sure, will do later. Soz, must have missed it. Could you find a link? Gotta go to school now
Check out the sig! Doesn't need any photoshopping, looks effective enoguh already.
'Store the text we want to put in the file in a variable
Dim input As String
input = txtFile.Text
'Show the dialog, its just like the OpenFileDialog.
dlgSave.ShowDialog()
'If user pressed cancel, the filename will be empty. This will cause errors, so:
If dlgSave.FileName <> "" Then
'Open the file. This time, we use OpenMode.Output because we are outputting data to the file.
FileOpen(1, dlgSave.FileName, OpenMode.Output)
'now simply output using printline to the file:
PrintLine(1, input)
'Close the file. This is an important step - if we dont do it errors will come up.
FileClose(1)
End If
FileClose(1)
Private Sub btnOpen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOpen.Click
Dim AllText As String
Dim LineOfText As String
dlgOpen.ShowDialog()
'If user pressed cancel, the filename will be empty. This will cause errors, so:
If dlgOpen.FileName <> "" Then
'Open the file
FileOpen(1, dlgOpen.FileName, OpenMode.Input)
'Loop through these instructions until we reach the End Of File
Do Until EOF(1)
'Get the next line from the file
LineOfText = LineInput(1)
'Add this line on to the end of the Alltext variable (with a new line- vbCrLf)
AllText = AllText & LineOfText & vbCrLf
Loop
FileClose(1)
'Display the file in the textbox
txtFile.Text = AllText
'Extra bonus bit. select the file
txtFile.Select(1, 0)
End If
End Sub
Private Sub btnSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnSave.Click
'Store the text we want to put in the file in a variable
Dim input As String
input = txtFile.Text
'Show the dialog, its just like the OpenFileDialog.
dlgSave.ShowDialog()
'If user pressed cancel, the filename will be empty. This will cause errors, so:
If dlgSave.FileName <> "" Then
'Open the file. This time, we use OpenMode.Output because we are outputting data to the file.
FileOpen(1, dlgSave.FileName, OpenMode.Output)
'now simply output using printline to the file:
PrintLine(1, input)
'Close the file. This is an important step - if we dont do it errors will come up.
FileClose(1)
End If
End Sub