santoshbhat
10-07-2009, 09:10 AM
Hello...
I have the following code for save button. The code is written in VB 6.0.. In the below code, when the save button is clicked, a window will be popped up and asks the location to save the file. But if I click the cancel button in the popped window it is giving a runtime error. Please go through the code and help me.. I want cancel button working fine...
Private Sub btnSave_Click()
With CommonDialog1
.CancelError=False
.InitDir="C:\"
.Filter="text files(*.txt)|*.txt|"
.ShowSave
End With
Open CommonDialog1.Filename For Append As #1
Print #1, Text1.Text ' here text present in Text1 is saved on to file
Close #1
End Sub
Thanx in advance
I have the following code for save button. The code is written in VB 6.0.. In the below code, when the save button is clicked, a window will be popped up and asks the location to save the file. But if I click the cancel button in the popped window it is giving a runtime error. Please go through the code and help me.. I want cancel button working fine...
Private Sub btnSave_Click()
With CommonDialog1
.CancelError=False
.InitDir="C:\"
.Filter="text files(*.txt)|*.txt|"
.ShowSave
End With
Open CommonDialog1.Filename For Append As #1
Print #1, Text1.Text ' here text present in Text1 is saved on to file
Close #1
End Sub
Thanx in advance