Windows Application multiple Navigation Form

Change form with button control Back,Next, and Cancel

Page 1 of 1

4 Replies - 7249 Views - Last Post: 08 September 2009 - 07:00 PM Rate Topic: -----

#1 hadist  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 07-September 09

Windows Application multiple Navigation Form

Post icon  Posted 07 September 2009 - 03:31 AM

Hi, everyone

I'm try to make a multiple form as like as navigation form. There are several form (MainForm, Form1,Form2,....and Next Form)
in the MainForm i'm put a "ADD" button, when i click on the add button Form1 is show up. On the Form1 there are 3 button (Back,Next,and Cancel) when i'm click Next Button on the Form1 then Form2 is show up and the same way to next button / back button

I want when I'm click Next Button the previous Form not behind in the active form

my code like this:
 #  Next Button Clicked script 
		   Dim f_mail As New MailAccountForm
   
			Dim Result As DialogResult = f_mail.ShowDialog()
			If Result = Windows.Forms.DialogResult.OK Then
				Me.DialogResult = Windows.Forms.DialogResult.OK
				Me.Close()
			End If



what's wrong on my code
me.Close not firing and still exist behind the active form

Hadi

This post has been edited by AdamSpeight2008: 07 September 2009 - 07:17 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Windows Application multiple Navigation Form

#2 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: Windows Application multiple Navigation Form

Posted 07 September 2009 - 03:42 AM

the showdialog() of a form will wait until that form is closed until the code after the showdialog will continue executing. Thus try this

Dim f_mail As New MailAccountForm
me.visible = false
Dim Result As DialogResult = f_mail.ShowDialog()
If Result = Windows.Forms.DialogResult.OK Then
Me.DialogResult = Windows.Forms.DialogResult.OK
Me.Close()
End If




I think though your approach of all these windows opening will add major complexity to your application.

Can't you have only one form that will do all the navigation?
Was This Post Helpful? 0
  • +
  • -

#3 hadist  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 07-September 09

Re: Windows Application multiple Navigation Form

Posted 07 September 2009 - 07:36 PM

Thanks for your reply

I have try give the code with Me.Visible=False on the FORM1, this cause The MainForm hide too and When I Click the Back Button on The FORM2 can't show up

this my code in the Back Button Clicked
me.DialogResult = Windows.forms.DialogResult.No
me.Close

Construct of Form in MyApplication
MainForm { with Add Remove Close Button }
FORM_1 { with Back Next Cancel Button }
FORM_2 { with Back Next Cancel Button }
FORM_3 { with Back Next Cancel Button }

Rules :
1. On Main Form Add Click than FORM_1 Show up and MainForm still behind the FORM_1
2. On FORM_1 Next Click than FORM_2 show up and MainForm still behind and The FORM_1 Close
3. On FORM_2 Back Click than FORM_2 Close and FORM_1 show up and MainForm still behind

can you give me suggestion the best way to implement that as like as installation wizard

Hadi
Was This Post Helpful? 0
  • +
  • -

#4 motcom  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 290
  • View blog
  • Posts: 1,371
  • Joined: 16-June 08

Re: Windows Application multiple Navigation Form

Posted 08 September 2009 - 12:06 AM

Ok, i presume your form1 and form2 are the same forms (100% do the same tasks)

I have attached a project that will call form1 each time the next button is clicked.

(Each form is a class, so you can run as many instances of that class, thus you can call it itself)

(How many dotnet programmers does it take to change a lightbulb? None, You just tell the lightbulb to change itself)

Check and see if this points to the correct direction.

You might want to limit the amount of forms that will be opened as they all take resources and handles.
Was This Post Helpful? 0
  • +
  • -

#5 hadist  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 07-September 09

Re: Windows Application multiple Navigation Form

Posted 08 September 2009 - 07:00 PM

Thank 4 ur reply

Your example is cascade window. In this case my application is not using cascade window but use navigation form as like as installation wizard when we are install some program.
MainForm still exist behind on the next form and previous form (except MainForm) must be closed. So at run time only 2 forms are visible (MainForm and the Form was Called when next button clicked)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1