Greetins all,
I have a problem that has me beating my head against the desk..
A simple form with a buttong, creates a sime form via click:
---
If lv1.SelectedItems.Count > 0 Then
Dim f As New frmAddEditEmp(CInt(lv1.SelectedItems(0).SubItems(0 ).Text))
f.ShowDialog()
End If
---
On frmAddEditEmp, all it has are a couple of text boxes, a save button and a
cancel button...
If a text box gets changed I'm setting a boolean var to 'true'
On the cancel button.click I have this code:
---
If _changed = True Then
If MessageBox.Show("Changes Made. Are you Sure you want to cancel?",
"Confirm Cancel", & _
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.Close()
End If
End If
---
No matter what I try, if I click 'No' on the message, the form disappears
and it takes me back to the parent... It should just exit the sub and keep
the form open.
I tried setting the form's cancel button property to use this button as well
as not using the cancel property, both have the same result.
I am woring on this in VS 2005 now, but tried it in 2003 with the same
results as well...
Thanks!
Matt 2 1447
This is the code I use.
If MessageBox.Show("Changes Made. Are you Sure you want to cancel?",
"Confirm Cancel", _
MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.DialogResult = Windows.Forms.DialogResult.Cancel
Else
Me.DialogResult = Nothing
End If
I don't bother calling Me.Close. Is it correct? I dunno. :)
Greg
"Matt Gabbard" <As***@ifyouwannaknow.com> wrote in message
news:ex****************@TK2MSFTNGP10.phx.gbl... Greetins all,
I have a problem that has me beating my head against the desk..
A simple form with a buttong, creates a sime form via click:
--- If lv1.SelectedItems.Count > 0 Then Dim f As New frmAddEditEmp(CInt(lv1.SelectedItems(0).SubItems(0 ).Text)) f.ShowDialog() End If ---
On frmAddEditEmp, all it has are a couple of text boxes, a save button and a cancel button... If a text box gets changed I'm setting a boolean var to 'true'
On the cancel button.click I have this code: --- If _changed = True Then If MessageBox.Show("Changes Made. Are you Sure you want to cancel?", "Confirm Cancel", & _ MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then Me.Close() End If End If ---
No matter what I try, if I click 'No' on the message, the form disappears and it takes me back to the parent... It should just exit the sub and keep the form open.
I tried setting the form's cancel button property to use this button as well as not using the cancel property, both have the same result.
I am woring on this in VS 2005 now, but tried it in 2003 with the same results as well...
Thanks!
Matt
That did it.. setting result to nothing kept my form open.
Many thanks!
"Greg Burns" <bl*******@newsgroups.nospam> wrote in message
news:eS**************@TK2MSFTNGP12.phx.gbl... This is the code I use.
If MessageBox.Show("Changes Made. Are you Sure you want to cancel?", "Confirm Cancel", _ MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then
Me.DialogResult = Windows.Forms.DialogResult.Cancel Else Me.DialogResult = Nothing End If
I don't bother calling Me.Close. Is it correct? I dunno. :)
Greg
"Matt Gabbard" <As***@ifyouwannaknow.com> wrote in message news:ex****************@TK2MSFTNGP10.phx.gbl... Greetins all,
I have a problem that has me beating my head against the desk..
A simple form with a buttong, creates a sime form via click:
--- If lv1.SelectedItems.Count > 0 Then Dim f As New frmAddEditEmp(CInt(lv1.SelectedItems(0).SubItems(0 ).Text)) f.ShowDialog() End If ---
On frmAddEditEmp, all it has are a couple of text boxes, a save button and a cancel button... If a text box gets changed I'm setting a boolean var to 'true'
On the cancel button.click I have this code: --- If _changed = True Then If MessageBox.Show("Changes Made. Are you Sure you want to cancel?", "Confirm Cancel", & _ MessageBoxButtons.YesNo) = Windows.Forms.DialogResult.Yes Then Me.Close() End If End If ---
No matter what I try, if I click 'No' on the message, the form disappears and it takes me back to the parent... It should just exit the sub and keep the form open.
I tried setting the form's cancel button property to use this button as well as not using the cancel property, both have the same result.
I am woring on this in VS 2005 now, but tried it in 2003 with the same results as well...
Thanks!
Matt
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: J P Singh |
last post by:
Hi All
I have been trying to resolve this all morning but have given up.
Please help.
I have the simple form as below. When I click it is not getting the form
action from the line inside...
|
by: Aaron Prohaska |
last post by:
I have just run into a problem where I have a page that posts back to
itself to execute code, except when the page does the post back it
somehow executes code that is in our home page for the site....
|
by: Default |
last post by:
Hi, I am new to C#, that is why I am not sure what kind of problem it is: Is
VS files corrupted , or something else. that is the problems description:
I am working on a small database project. I am...
|
by: Russ |
last post by:
I've been trying to figure out how to show a simple messagebox with an
OK button in my web client program (C#). I have looked at every
reference to JScript and MessageBox that seemed even remotely...
|
by: qe_Cui |
last post by:
Hello Everyone:
I am using vb.net 2003 / SqlServer 2000 / Windows2000 Professional OS.
I put a combobox in a form in my application, it works well in my own pc.
But when I relase it to a...
|
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: ChrisM |
last post by:
I posted this last week, so apologies for re-posting but I'm still looking
for a sensible answer, and I'm hoping somone new might be able to cast some
light...
Basically, I have a fairly...
|
by: John Kraft |
last post by:
Hello all,
I'm experiencing some, imo, strange behavior with the StreamReader
object I am using in the code below. Summary is that I am downloading
a file from a website and saving it to disk...
|
by: =?Utf-8?B?Y2FsZGVyYXJh?= |
last post by:
Dear all,
I have a strange behaviour on the use of delagate. I will try to explain.
I have an assembly (Lets call it AssmDB) which contains database function
operation like Insert, Delete,...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
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...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
| |