Steve36445
Well-known member
- Joined
- Dec 23, 2007
- Messages
- 58
- Programming Experience
- 10+
Can you help me please?
I am trying to make a custom save dialogue box.
I am trying to test to see if a selected file exists when the save button is pressed and if it does it should show an overwrite message, if it is decided to overwrite the existing file it should return vbOK the file name and path is then available as the standard save dialogue box.
The problem is if I try to exit the save button routine before hiding the form i.e. not accept file. The form still closes.
It seems that once the "form accept" button is pressed no matter what happens vbOK will be returned and the form will be closed.
Is there something like "e.handled" in the keypress event.
Simplified code below-
thanks in advance,
Steve
I am trying to make a custom save dialogue box.
I am trying to test to see if a selected file exists when the save button is pressed and if it does it should show an overwrite message, if it is decided to overwrite the existing file it should return vbOK the file name and path is then available as the standard save dialogue box.
The problem is if I try to exit the save button routine before hiding the form i.e. not accept file. The form still closes.
It seems that once the "form accept" button is pressed no matter what happens vbOK will be returned and the form will be closed.
Is there something like "e.handled" in the keypress event.
Simplified code below-
VB.NET:
'Set out the forms and buttons
Me.AcceptButton = okay_button
Me.cancel_button = cancel_button
Me.ControlBox = False
AcceptButton.DialogResult = vbOK
cancel_button.DialogResult = vbCancel
Private Sub okay_button_Click(sender As System.Object, e As System.EventArgs) Handles okay_button.Click
If CheckBox1.Checked = False Then
Exit Sub
End If
Me.Close()
End Sub
thanks in advance,
Steve