473,385 Members | 1,983 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,385 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 2171
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.