hi,
i have a method to close my form, but it simply send a message box to ask if i want to save the changes or not or to cancel closing the form.
the problem is when i cancel the form closing my form go back behind every running program on the desktop
here its my method tell me what is wrong on it
Private Sub Main_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing Dim result As DialogResultresult = MessageBox.Show(
"do you want to save the changes before you close ", _ "Save Changes", MessageBoxButtons.YesNoCancel, _MessageBoxIcon.Question, MessageBoxDefaultButton.Button2, _
MessageBoxOptions.DefaultDesktopOnly,
False) Select Case result Case Windows.Forms.DialogResult.OK 'todo: save the changes in the dataset then close this form Case Windows.Forms.DialogResult.No 'todo: don't save changes and close the form Case Windows.Forms.DialogResult.Cancel 'skip this methode.Cancel =
True Me.Focus() End Select End Subi don't know whats wrong on it
thx bye

Help: form focus
Ling A
The cause of this is the MessageBoxOptions.DefaultDesktopOnly option. This option is really only for use when creating Windows Services.
Remove the option and it should work fine.
vasu_ve
hi,
Thx Mr.David it worked perfectly
best regards