473,394 Members | 1,902 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 2172
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....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.