Hi all.. Something strange with something that should be simple.
Have a form with a button that calls another form (showdialog)
--
10 Dim f As New frmTrainRecMaint(frmTrainRecMaint.enmFormAction.Ad dNew)
20 f.ShowDialog()
30 If f.dialogResult = DialogResult.OK Then
40 SetupDG()
50 End If
--
frmForm has a cancel button, under the click event I have:
--
5 Private Sub btnCancel_Click (...)
10 If ChangesMade = True Then
20 If MessageBox.Show("Changes made, cancel?", "Verify Cancel",
MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then
30 Me.DialogResult = DialogResult.Cancel
40 Me.Dispose()
50 End If
60 End If
70 End Sub
--
tracking it, everything works great, but when it gets to the end of the
click event, 70,
the run jumps back to the parent form and continues with 30.
frmForm dissapears. It never runs the me.dispose, so where'd it go!?!?
Help! Thanks,
Matt 2 811
> 5 Private Sub btnCancel_Click (...) 10 If ChangesMade = True Then 20 If MessageBox.Show("Changes made, cancel?", "Verify Cancel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then 30 Me.DialogResult = DialogResult.Cancel 40 Me.Dispose() 50 End If 60 End If 70 End Sub
At line 5 Me.DialogResult is already DialogResult.Cancel, since the user
clicked the cancel button. Nowhere in this Sub do you change the result to
anything else, so it should ALWAYS be cancel.
Thanks! Changed the dr to none and my code controls the canceling now.
Thanks Again,
Matt
"Noozer" <do*******@me.here> wrote in message
news:u%****************@TK2MSFTNGP14.phx.gbl... 5 Private Sub btnCancel_Click (...) 10 If ChangesMade = True Then 20 If MessageBox.Show("Changes made, cancel?", "Verify Cancel", MessageBoxButtons.YesNo, MessageBoxIcon.Question) = DialogResult.Yes Then 30 Me.DialogResult = DialogResult.Cancel 40 Me.Dispose() 50 End If 60 End If 70 End Sub
At line 5 Me.DialogResult is already DialogResult.Cancel, since the user clicked the cancel button. Nowhere in this Sub do you change the result to anything else, so it should ALWAYS be cancel. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: William Wisnieski |
last post by:
Hello Everyone:
I'm having a very strange problem occurring with my Access 2000 database. I
call it the "mystery record."
Here's the story:
I have a query by form that returns a record set...
|
by: Richard Hollenbeck |
last post by:
I've asked this question before but over a month later I still don't have an
answer. A few people did try to help and I am thankful, but I really didn't
get the problem solved. I'll try to ask...
|
by: Ziggy |
last post by:
Just for curiosity.
I know that main function is returning
an int, but I came cross with the following
code. (Unnessecary code is snipped) Is there
any problem with it?
#include <stdlib.h>...
|
by: the friendly display name |
last post by:
Hi,
I have a filled multiline textbox on the site. I can scroll it with IE and
Firefox, but under Opera (tested under 7.54, and Opera 8, under "identify as
MSIE" and under Opera identification)...
|
by: Tyler Foreman |
last post by:
Hello,
I have a strange problem that occurs every so often in my
application. It usually takes place when I hide one form
and activate another. What happens is I get the
following exception:...
|
by: George Hardy IV |
last post by:
Hello all,
I have two forms in my project...
one form allows me to use the arrow keys to move and delete controls on my
form.
the other form does NOT allow me to delete controls or move them...
|
by: Joseph Geretz |
last post by:
Writing an Outlook AddIn with C#. For the user interface within Outlook I'm
adding matching pairs of Toolbar buttons and Menu items. All of the buttons
and menu items are wired up to send events to...
|
by: senfo |
last post by:
I developed a Windows control in VS 2005 that inherits from the
PictureBox Control that adds the ability to select images in a Windows
application. It is, however, experiencing a strange issue...
|
by: navneet0909 |
last post by:
hii,
I have a strange problem while working on a MS Access db. The code is in VBA..
I have a main form A, and a button to call a subform B.
now the form B has some lists which inserts data. That...
|
by: TC |
last post by:
I have a form which I'd like to display as a sizable dialog box. The
behavior I get when I use FormBorderStyle = SizableToolWindow is
perfect. However, when I use that option, the title bar of my...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: 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,...
|
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...
|
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,...
| |