471,325 Members | 1,438 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,325 software developers and data experts.

Help with custom dialog

'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


Jul 28 '05 #1
1 2095
this seems to be occuring as a result of showDialog. when I change it to
show, no exception is thrown.

more over, I am not able to catch this exception, and it halts the
application.
"AMDRIT" <am****@hotmail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
'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

Jul 28 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

7 posts views Thread by WindAndWaves | last post: by
2 posts views Thread by Dennis C. Drumm | last post: by
4 posts views Thread by logicalfeline | last post: by
2 posts views Thread by J-Rod | last post: by
3 posts views Thread by boney.dalwani | last post: by
1 post views Thread by rn5a | last post: by
2 posts views Thread by deciacco | last post: by
8 posts views Thread by vunet.us | last post: by
9 posts views Thread by Gord | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.