strange windows behaviour

  • Thread starter Thread starter EricW
  • Start date Start date
E

EricW

Hi,

Before my main form is opened, I have my program check some things.
One of the checks will open a form and when the user clicks on a button on
that form, it will open another form to fill in some data.
On the last form there 2 buttons, one to save and one to cancel.
On save the data is stored in properties and then the form is closed, cancel
just closes the form.

it's something like:

sub Main()
dim frm as new FirstForm
frm.showdialog

dim frmMain as new frmMain
frmMain.showdialog
end sub

sub btAdd( sender as object.....) handles btAdd.click
dim frmAdd as new SecondForm
frmAdd.showdialog

strName = frmAdd.name
etc..

frmadd.dispose

end sub

on frmAdd the data from the textboxes is put in the properties like Name.

The Problem:
When either button is pressed, instead of just closing the second form, the
first form is also closed and the program continues and loads the main form.
So it goes from closing frmAdd straight to 'dim frmMain as new frmMain' in
stead of going to frmAdd.dispose and staying in FirstForm.

I cannot find anything wrong in my code, but I'm probably overlooking
something.

Can anyone give me some points on where to look for this kind of problem?

thank you,
Eric
 
NVM, found the problem...

The buttons I used to call the next window were set on DialogResult =
Cancel.

Guess thats the risk of copy and paste....

rg,
Eric
 
Back
Top