473,657 Members | 2,395 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Help with custom dialog

'System.Runtime .InteropService s.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 policyStatusCha nge

Inherits System.Windows. Forms.Form

Event Result(ByVal e As System.Windows. Forms.DialogRes ult)

Private Sub btnOk_Click(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles btnOk.Click

RaiseEvent Result(DialogRe sult.OK)

Close()

End Sub

Private Sub btnCancel_Click (ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnCancel.Click

RaiseEvent Result(DialogRe sult.Cancel)

Close()

End Sub

End Class

Public Class CustomDialog

Private Shared iRet As System.Windows. Forms.DialogRes ult

Public Shared Function Show(ByVal dr As
QuickCommercial Web.DataDiction ary.Application sRow, ByVal PendingChange As
String, ByVal CurrentValue As String) As System.Windows. Forms.DialogRes ult

Dim frmPSC As policyStatusCha nge

Dim Results As System.Windows. Forms.DialogRes ult

iRet = DialogResult.Ca ncel

frmPSC = New policyStatusCha nge(dr, PendingChange, CurrentValue)

AddHandler frmPSC.Result, AddressOf form_result

frmPSC.ShowDial og()

Select Case iRet

Case DialogResult.OK

MsgBox("user said ok.")

Case DialogResult.Ca ncel

MsgBox("user said cancel.")

End Select

RemoveHandler frmPSC.Result, AddressOf form_result

'frmPSC.Dispose ()

End Function

Private Shared Sub form_result(ByV al e As System.Windows. Forms.DialogRes ult)

iRet = e

End Sub

End Class


Jul 28 '05 #1
1 2185
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******** ********@tk2msf tngp13.phx.gbl. ..
'System.Runtime .InteropService s.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 policyStatusCha nge

Inherits System.Windows. Forms.Form

Event Result(ByVal e As System.Windows. Forms.DialogRes ult)

Private Sub btnOk_Click(ByV al sender As System.Object, ByVal e As
System.EventArg s) Handles btnOk.Click

RaiseEvent Result(DialogRe sult.OK)

Close()

End Sub

Private Sub btnCancel_Click (ByVal sender As Object, ByVal e As
System.EventArg s) Handles btnCancel.Click

RaiseEvent Result(DialogRe sult.Cancel)

Close()

End Sub

End Class

Public Class CustomDialog

Private Shared iRet As System.Windows. Forms.DialogRes ult

Public Shared Function Show(ByVal dr As
QuickCommercial Web.DataDiction ary.Application sRow, ByVal PendingChange As
String, ByVal CurrentValue As String) As System.Windows. Forms.DialogRes ult

Dim frmPSC As policyStatusCha nge

Dim Results As System.Windows. Forms.DialogRes ult

iRet = DialogResult.Ca ncel

frmPSC = New policyStatusCha nge(dr, PendingChange, CurrentValue)

AddHandler frmPSC.Result, AddressOf form_result

frmPSC.ShowDial og()

Select Case iRet

Case DialogResult.OK

MsgBox("user said ok.")

Case DialogResult.Ca ncel

MsgBox("user said cancel.")

End Select

RemoveHandler frmPSC.Result, AddressOf form_result

'frmPSC.Dispose ()

End Function

Private Shared Sub form_result(ByV al e As
System.Windows. Forms.DialogRes ult)

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
15257
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 form 2- users clicks on a button in the custom form 3- answer from user is passed back to original procedure (e.g. whether the answer was Yes or No).
2
30143
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.) and would like to make the dialog look and act like the standard MessageBox. Therefore, I would like to put in the message section the same type of icons found in the MessageBox dialog, such as MessageBoxIcon.Exclamation. In another post here I had...
4
8902
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 form that allowed the user to choose the datapath and confirm it then add this to the installation project. I'm having trouble with this however. Does anyone know a simple procedure for doing this? Cat
2
2631
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 hash value, since i found this to be the easiest way to store it. However, i want the user to be able to add custom colors. When they create a custom color within the dialog, it is not saved there on returning to the dialog. I was thinking about...
3
13507
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 to contruct a custom dailog Box. Is it possible to construct a custom dailog Box using javascript ? if yes, can anybody guide me through the mechanism ....
0
1891
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 Installer class. This installer class inturn displays the custom dialog box i need. but the problem is this custom dialog box is displayed as a popup window during installation. But I want this custom dialog box to be shown as one of the wizard...
1
3214
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' & 'Cancel'). Till this point, no problem. Initially, the TextBox is empty. The Button has a property named 'ConfirmMessage' so that the developer using this custom control can modify the question in the confirm dialog. If the user clicks 'OK', I want the...
2
7274
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 drop into my form designer. Then set some properties from within code before calling the showDialog method. I'm not trying to recreate the FolderBrowserDialog. Just my own custom dialog that captures some data. example:
8
4843
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 all the way below. If I do not "demand" that file but, rather, write locally, everything works smoothly with included file tiny_mce.js. But my HTML object required for initialization appears on the page when user decides to make it appear,...
9
5486
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. Using Access 07, a form is a little different beast and it would appear a custom dialog cannot be created in the same way. How does one go about creating a custom dialog? Note that I am not well experienced in programming but I have a couple of...
0
8394
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8306
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8825
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
6164
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5632
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4304
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1955
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.