A
AMDRIT
'System.Runtime.InteropServices.SEHException' occurred in
system.windows.forms.dll is generated when I use "My Custom Dialog". Any
ideas what I could be doing wrong?
Basically, I wanted to create a dialog like Messagebox. I created a class
with a public shared function that returns a dialogresult. I then created a
form with an event and two buttons.
TIA
Public Class policyStatusChange
Inherits System.Windows.Forms.Form
Event Result(ByVal e As System.Windows.Forms.DialogResult)
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOk.Click
RaiseEvent Result(DialogResult.OK)
Close()
End Sub
Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
RaiseEvent Result(DialogResult.Cancel)
Close()
End Sub
End Class
Public Class CustomDialog
Private Shared iRet As System.Windows.Forms.DialogResult
Public Shared Function Show(ByVal dr As
QuickCommercialWeb.DataDictionary.ApplicationsRow, ByVal PendingChange As
String, ByVal CurrentValue As String) As System.Windows.Forms.DialogResult
Dim frmPSC As policyStatusChange
Dim Results As System.Windows.Forms.DialogResult
iRet = DialogResult.Cancel
frmPSC = New policyStatusChange(dr, PendingChange, CurrentValue)
AddHandler frmPSC.Result, AddressOf form_result
frmPSC.ShowDialog()
Select Case iRet
Case DialogResult.OK
MsgBox("user said ok.")
Case DialogResult.Cancel
MsgBox("user said cancel.")
End Select
RemoveHandler frmPSC.Result, AddressOf form_result
'frmPSC.Dispose()
End Function
Private Shared Sub form_result(ByVal e As System.Windows.Forms.DialogResult)
iRet = e
End Sub
End Class
system.windows.forms.dll is generated when I use "My Custom Dialog". Any
ideas what I could be doing wrong?
Basically, I wanted to create a dialog like Messagebox. I created a class
with a public shared function that returns a dialogresult. I then created a
form with an event and two buttons.
TIA
Public Class policyStatusChange
Inherits System.Windows.Forms.Form
Event Result(ByVal e As System.Windows.Forms.DialogResult)
Private Sub btnOk_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btnOk.Click
RaiseEvent Result(DialogResult.OK)
Close()
End Sub
Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As
System.EventArgs) Handles btnCancel.Click
RaiseEvent Result(DialogResult.Cancel)
Close()
End Sub
End Class
Public Class CustomDialog
Private Shared iRet As System.Windows.Forms.DialogResult
Public Shared Function Show(ByVal dr As
QuickCommercialWeb.DataDictionary.ApplicationsRow, ByVal PendingChange As
String, ByVal CurrentValue As String) As System.Windows.Forms.DialogResult
Dim frmPSC As policyStatusChange
Dim Results As System.Windows.Forms.DialogResult
iRet = DialogResult.Cancel
frmPSC = New policyStatusChange(dr, PendingChange, CurrentValue)
AddHandler frmPSC.Result, AddressOf form_result
frmPSC.ShowDialog()
Select Case iRet
Case DialogResult.OK
MsgBox("user said ok.")
Case DialogResult.Cancel
MsgBox("user said cancel.")
End Select
RemoveHandler frmPSC.Result, AddressOf form_result
'frmPSC.Dispose()
End Function
Private Shared Sub form_result(ByVal e As System.Windows.Forms.DialogResult)
iRet = e
End Sub
End Class