Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2008

Tip: Looking for answers? Try searching our database.

strange windows behaviour

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
EricW - 10 Jan 2008 13:09 GMT
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
EricW - 10 Jan 2008 16:02 GMT
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

> Hi,
>
[quoted text clipped - 42 lines]
> thank you,
> Eric

Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.