Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ''' <summary>
- ''' Close the current form.
- ''' </summary>
- ''' <returns>True when a form was found and a close request sent</returns>
- <WebMethod>
- Public Shared Function HitFormBackButtonIfPossible() As Boolean
- Dim intMax As Integer = Application.OpenForms.Count
- If Application.OpenForms(intMax - 1) IsNot Nothing Then
- Dim intCurrentForm As Form = Application.OpenForms(intMax - 1)
- 'See if this form has a method called RequestFormClose()
- Dim mi As Reflection.MethodInfo = intCurrentForm.GetType().GetMethod("RequestFormClose")
- If mi IsNot Nothing Then
- 'Form has that method. Call it, and let the form handle it.
- CallByName(intCurrentForm, "RequestFormClose", CallType.Method)
- Else
- 'Form does not contain that method. We will close the form ourselves.
- intCurrentForm.DialogResult = DialogResult.Cancel
- intCurrentForm.Close()
- End If
- Return True 'Indicate a close request was sent/handled
- Else
- Return False 'No form found.
- End If
- End Function
- Form Code
- If e.Tool.Name = "btnBack" Then
- RequestFormClose()
- End If
- Public Sub RequestFormClose()
- SaveIssuesListViewUserSettings()
- 'Store last lvIssues results from the criteria selections
- etc....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement