EDN Admin
Well-known member
hi I am learning to write a football system programme in vb6. I have numerous text boxes on the form which I enter details of 10 matches. There are about 80 text boxes with data in, then I wait til matches have been played and enter the scores. This is where
my problem is. I have set up a save as dialogue box to save the data but it wont save anything to c:/drive. I press the save control, the save as dialogue box appears on screen and I enter the programme name, but it wont save anything. If I exit my programme
I lose all the data I have entered and I have to start from scratch again entering the same data. Is there anybody who knows what sort of code I should be writing to eneble the save as dialogue box to actually save the data entered. I have written the following
code but it doesnt actually save anything to c:/ drive.
Private Sub cmdSave_Click()<br/>
Sets the Dialog Title to Save File<br/>
cdbfile.DialogTitle = "Save File"
Sets the File List box to Text File and All Files<br/>
cdbfile.Filter = "Text File (*.txt)|*.*| AllFiles (*.*)|*.*"
Set the default files type to Text File<br/>
cdbfile.FilterIndex = 1
Sets the flags - Hide Read only, prompt to overwrite, and path must exist<br/>
cdbfile.Flags = cdlOFNHideReadOnly + cdlOFNOverwritePrompt _<br/>
+ cdlOFNPathMustExist
Set dialog box so an error occurs if the dialogbox is cancelled<br/>
cdbfile.CancelError = True
Enables error handling to catch cancel error<br/>
On Error Resume Next<br/>
display the dialog box<br/>
cdbfile.ShowSave<br/>
If Err Then<br/>
This code runs if the dialog was cancelled<br/>
MsgBox "Dialog Cancelled"<br/>
Exit Sub<br/>
End If
Displays a message box.<br/>
MsgBox "You saved the files as " & cdbfile.FileName<br/>
End Sub
View the full article
my problem is. I have set up a save as dialogue box to save the data but it wont save anything to c:/drive. I press the save control, the save as dialogue box appears on screen and I enter the programme name, but it wont save anything. If I exit my programme
I lose all the data I have entered and I have to start from scratch again entering the same data. Is there anybody who knows what sort of code I should be writing to eneble the save as dialogue box to actually save the data entered. I have written the following
code but it doesnt actually save anything to c:/ drive.
Private Sub cmdSave_Click()<br/>
Sets the Dialog Title to Save File<br/>
cdbfile.DialogTitle = "Save File"
Sets the File List box to Text File and All Files<br/>
cdbfile.Filter = "Text File (*.txt)|*.*| AllFiles (*.*)|*.*"
Set the default files type to Text File<br/>
cdbfile.FilterIndex = 1
Sets the flags - Hide Read only, prompt to overwrite, and path must exist<br/>
cdbfile.Flags = cdlOFNHideReadOnly + cdlOFNOverwritePrompt _<br/>
+ cdlOFNPathMustExist
Set dialog box so an error occurs if the dialogbox is cancelled<br/>
cdbfile.CancelError = True
Enables error handling to catch cancel error<br/>
On Error Resume Next<br/>
display the dialog box<br/>
cdbfile.ShowSave<br/>
If Err Then<br/>
This code runs if the dialog was cancelled<br/>
MsgBox "Dialog Cancelled"<br/>
Exit Sub<br/>
End If
Displays a message box.<br/>
MsgBox "You saved the files as " & cdbfile.FileName<br/>
End Sub
View the full article