472,805 Members | 941 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,805 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 2143
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: WindAndWaves | last post by:
Hi Gurus I am trying to make a custom message box with a dialog form. Here is how I would like to do it: 1- anywhere in the database, in any procedure, I call the function that opens a dialog...
2
by: Dennis C. Drumm | last post by:
This is a restatement of an earlier post that evidently wasn't clear. I am building a custom MessageBox dialog that has, among other things, a few new button options (yes to all, no to all, etc.)...
4
by: logicalfeline | last post by:
Hi there, I'm creating an installation project where at a particular point in the installation I want the user to be able to specify a filepath for use in the program. My idea was to create a...
2
by: J-Rod | last post by:
Hi everyone/anyone, I am using a button in my app that opens the color dialog, and allows the user to select a color which changes the backcolor of a label. I then store the color in my db as a...
3
by: boney.dalwani | last post by:
Hello All, I m new to JavaScript and widely Exploring programming in js i have a situation where in i do not want to use alert(message); / prompt(message) kind of functionility. rather i want...
0
by: Gancy | last post by:
Hi In my setup project I need a custom dialog box containing a drop down list box. Since this is not avaialble from standard user interface dialog boxes that visual studio supplies, I am using...
1
by: rn5a | last post by:
I want to create a custom control that encapsulates a Button & a TextBox. When the Button is clicked, the user is asked a question using JavaScript confirm (which shows 2 buttons - 'OK' &...
2
by: deciacco | last post by:
VS2k5 - C# .NET 2 I would like to create my own custom dialog that behaves like the FolderBrowserDialog. In other words, I would like to be able to go to the ToolBox, select my custom dialog and...
8
by: vunet.us | last post by:
Hi all, I have difficulties initializing TinyMCE. Initialization involved 1 included file tiny_mce.js and one which I include "on demand" (see tinyMCEOnDemand()). The content of that function is...
9
by: Gord | last post by:
In VB6, a custom dialog can be easily created by adding a new form, adding whatever controls you like, sizing it as you like, adding code and then just loading/unloading it whenever you like....
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: erikbower65 | last post by:
Here's a concise step-by-step guide for manually installing IntelliJ IDEA: 1. Download: Visit the official JetBrains website and download the IntelliJ IDEA Community or Ultimate edition based on...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
14
DJRhino1175
by: DJRhino1175 | last post by:
When I run this code I get an error, its Run-time error# 424 Object required...This is my first attempt at doing something like this. I test the entire code and it worked until I added this - If...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.