473,405 Members | 2,421 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Back and Forward.

Hi, guys.
My application requires functionalities like back and
forward navigating button on winforms. And there are
many forms linking each other. Each form has a pair of
buttons of "Back" and "Forward "How can I implement the
back and forward procedure to make them work ?

Is there anyone has the same experience like that ?

Thanks
Nov 20 '05 #1
8 6502
"Tracey" <jo********@hotmail.com> wrote in news:0a5001c383b6$60bad790
$a*******@phx.gbl:
Hi, guys.
My application requires functionalities like back and
forward navigating button on winforms. And there are
many forms linking each other. Each form has a pair of
buttons of "Back" and "Forward "How can I implement the
back and forward procedure to make them work ?

Is there anyone has the same experience like that ?


I have a template form which has the forward/back button, and items that
are global for all pages. I have a User control for each "page" with the
appropriate layout. I swap the User control when the user presses
forward/backward.

As for storing options, I have a class object in the template form that
stores the pertinent options for each page. The object is passed into the
constructor of the user controls. The user control populates the selected
options if the user is viewing a previous page. I'm still working on this
part though.

If anyone has done this before, I would like to know how you did it as
well. Thanks!

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/
Nov 20 '05 #2
Hello,

"Tracey" <jo********@hotmail.com> schrieb:
My application requires functionalities like back and
forward navigating button on winforms. And there are
many forms linking each other. Each form has a pair of
buttons of "Back" and "Forward "How can I implement the
back and forward procedure to make them work ?


You can create multiple usercontrols, one for each page, and show only the
active page. Maybe you can provide more details on where to navigate
forward and backward.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #3
Navigation of forms can be very easily and effectively achieved creating a
Navigator Class that maintains the navigation path and also keeps track of
the current form. When the user clicks on forward or backward, you just call
the Navigator's Next/Previous methods.

"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. .
"Tracey" <jo********@hotmail.com> wrote in news:0a5001c383b6$60bad790
$a*******@phx.gbl:
Hi, guys.
My application requires functionalities like back and
forward navigating button on winforms. And there are
many forms linking each other. Each form has a pair of
buttons of "Back" and "Forward "How can I implement the
back and forward procedure to make them work ?

Is there anyone has the same experience like that ?


I have a template form which has the forward/back button, and items that
are global for all pages. I have a User control for each "page" with the
appropriate layout. I swap the User control when the user presses
forward/backward.

As for storing options, I have a class object in the template form that
stores the pertinent options for each page. The object is passed into the
constructor of the user controls. The user control populates the selected
options if the user is viewing a previous page. I'm still working on this
part though.

If anyone has done this before, I would like to know how you did it as
well. Thanks!

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 20 '05 #4
Navigation of forms can be very easily and effectively achieved creating a
Navigator Class that maintains the navigation path and also keeps track of
the current form. When the user clicks on forward or backward, you just call
the Navigator's Next/Previous methods.
"Lucas Tam" <RE********@rogers.com> wrote in message
news:Xn***************************@140.99.99.130.. .
"Tracey" <jo********@hotmail.com> wrote in news:0a5001c383b6$60bad790
$a*******@phx.gbl:
Hi, guys.
My application requires functionalities like back and
forward navigating button on winforms. And there are
many forms linking each other. Each form has a pair of
buttons of "Back" and "Forward "How can I implement the
back and forward procedure to make them work ?

Is there anyone has the same experience like that ?


I have a template form which has the forward/back button, and items that
are global for all pages. I have a User control for each "page" with the
appropriate layout. I swap the User control when the user presses
forward/backward.

As for storing options, I have a class object in the template form that
stores the pertinent options for each page. The object is passed into the
constructor of the user controls. The user control populates the selected
options if the user is viewing a previous page. I'm still working on this
part though.

If anyone has done this before, I would like to know how you did it as
well. Thanks!

--
Lucas Tam (RE********@rogers.com)
Please delete "REMOVE" from the e-mail address when replying.
http://members.ebay.com/aboutme/coolspot18/

Nov 20 '05 #5
Hello,

"Tracey" <jo********@hotmail.com> schrieb:
My application requires functionalities like back and
forward navigating button on winforms. And there are
many forms linking each other. Each form has a pair of
buttons of "Back" and "Forward "How can I implement the
back and forward procedure to make them work ?


You can create multiple usercontrols, one for each page, and show only the
active page. Maybe you can provide more details on where to navigate
forward and backward.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #6
Tracey,

I have navigation(First,Previous,Next,Last) and command
buttons(Add,Update,Delete,Close) on a MDI Parent that control the actions of
the MDI children.

First I use a "Generic" form

Public Class A
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer.
InitializeComponent()

'Add any initialization after the InitializeComponent() call

End Sub

'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer

'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()
components = New System.ComponentModel.Container
End Sub

Public Overridable WriteOnly Property Navigate()
Set(ByVal Value)
Select Case Value
Case "Print"
Case "First"
Case "Previous"
Case "Next"
Case "Last"
Case "Add"
Case "Update"
Case "Delete"
Case "Close"
Case "Save"
End Select
End Set
End Property

#End Region

End Class

Then I derive all my MDI children from the above class.

Public Class frmRate
Inherits A

THE FOLLOWING PROPERTY IS USED BY MDI PARENT TO SEND COMMAND FROM TOOLBAR TO
CHILDREN

Public Overrides WriteOnly Property Navigate()
Set(ByVal Value)
Select Case Value
Case "Print"
Case "First"
Me.BindingContext(dsDataSet, "Ratefil").Position =
Me.BindingContext(dsDataSet).Position.MinValue
Case "Previous"
Me.BindingContext(dsDataSet, "Ratefil").Position -= 1
Case "Next"
Me.BindingContext(dsDataSet, "Ratefil").Position += 1
Case "Last"
Me.BindingContext(dsDataSet, "Ratefil").Position =
Me.BindingContext(dsDataSet).Position.MaxValue
Case "Add"
btAdd_Click("", System.EventArgs.Empty)
Case "Update"
btUpdate_Click("", System.EventArgs.Empty)
Case "Delete"
btDelete_Click("", System.EventArgs.Empty)
Case "Close"
End Select
End Set
End Property

In my MDI Parent this Sub is used to send messages to the MDI Children.

Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal e
As System.Windows.Forms.ToolBarButtonClickEventArgs) Handles
ToolBar1.ButtonClick
Try
Dim activeChild As Form = Me.ActiveMdiChild
If ActForm <> -1 Then
DirectCast(activeChild, A).Navigate =
e.Button.Text.ToString
End If
Catch ex As Exception
MessageBox.Show(ex.Source.ToString & " - " & ex.Message,
Application.ProductName, _
MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
End Sub

Hope this help. If this works thank Herfried he helped me with
ToolBar1_ButtonClick and "Generic" form code.

Ken
Nov 20 '05 #7
Thanks for your advice.
THe winforms in my application already have button
controls on each form, say "Back" and "Forward".

My winform have multiple links to other forms. And link
in other forms will also link to this form.

did I provide enough information ?
-----Original Message-----
Hello,

"Tracey" <jo********@hotmail.com> schrieb:
My application requires functionalities like back and
forward navigating button on winforms. And there are
many forms linking each other. Each form has a pair of
buttons of "Back" and "Forward "How can I implement the
back and forward procedure to make them work ?
You can create multiple usercontrols, one for each page,

and show only theactive page. Maybe you can provide more details on where to navigateforward and backward.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
.

Nov 20 '05 #8
Thanks, Ken.
But my application is not a MDI Form application.

I got something useful from your code.
Thanks again!

-----Original Message-----
Tracey,

I have navigation(First,Previous,Next,Last) and command
buttons(Add,Update,Delete,Close) on a MDI Parent that control the actions ofthe MDI children.

First I use a "Generic" form

Public Class A
Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

Public Sub New()
MyBase.New()

'This call is required by the Windows Form Designer. InitializeComponent()

'Add any initialization after the InitializeComponent() call
End Sub

'Form overrides dispose to clean up the component list. Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean) If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub

'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer 'It can be modified using the Windows Form Designer. 'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()> Private SubInitializeComponent()
components = New System.ComponentModel.Container
End Sub

Public Overridable WriteOnly Property Navigate()
Set(ByVal Value)
Select Case Value
Case "Print"
Case "First"
Case "Previous"
Case "Next"
Case "Last"
Case "Add"
Case "Update"
Case "Delete"
Case "Close"
Case "Save"
End Select
End Set
End Property

#End Region

End Class

Then I derive all my MDI children from the above class.

Public Class frmRate
Inherits A

THE FOLLOWING PROPERTY IS USED BY MDI PARENT TO SEND COMMAND FROM TOOLBAR TOCHILDREN

Public Overrides WriteOnly Property Navigate()
Set(ByVal Value)
Select Case Value
Case "Print"
Case "First"
Me.BindingContext (dsDataSet, "Ratefil").Position =Me.BindingContext(dsDataSet).Position.MinValue
Case "Previous"
Me.BindingContext (dsDataSet, "Ratefil").Position -= 1 Case "Next"
Me.BindingContext (dsDataSet, "Ratefil").Position += 1 Case "Last"
Me.BindingContext (dsDataSet, "Ratefil").Position =Me.BindingContext(dsDataSet).Position.MaxValue
Case "Add"
btAdd_Click("", System.EventArgs.Empty) Case "Update"
btUpdate_Click("", System.EventArgs.Empty) Case "Delete"
btDelete_Click("", System.EventArgs.Empty) Case "Close"
End Select
End Set
End Property

In my MDI Parent this Sub is used to send messages to the MDI Children.
Private Sub ToolBar1_ButtonClick(ByVal sender As System.Object, ByVal eAs System.Windows.Forms.ToolBarButtonClickEventArgs) HandlesToolBar1.ButtonClick
Try
Dim activeChild As Form = Me.ActiveMdiChild
If ActForm <> -1 Then
DirectCast(activeChild, A).Navigate =
e.Button.Text.ToString
End If
Catch ex As Exception
MessageBox.Show(ex.Source.ToString & " - " & ex.Message,Application.ProductName, _
MessageBoxButtons.OK, MessageBoxIcon.Error) End Try
End Sub

Hope this help. If this works thank Herfried he helped me withToolBar1_ButtonClick and "Generic" form code.

Ken
.

Nov 20 '05 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Bud Zielinski | last post by:
Can someone point me to a script that will allow me to implement a "back button" in an HTA, since there is no history for HTA's. Understand this requires an array, is there any sample code out...
3
by: Nick Tew | last post by:
Hi, Firstly, any help would be gratefully received. Im using several iframes on a single page and would like individual 'back' and 'forward' buttons located in each of the iframes which only...
3
by: pmelanso | last post by:
hello, I want to create back and forward buttons on my web page. I didn't have a problem with that... the thing I am having trouble with is I woudl like to display "disabled" images when there if...
10
by: pmelanso | last post by:
Hello, How can I tell if there is a page to go back to in the history or not??? Same with forward??? say something like/// if (there is a page to go back to ) { // DO something }else { }
5
by: Mały Piotruœ | last post by:
Hello, (Sorry for my english.) I am new to HTML/JavaScript/CSS. I would like to ask for help with such a problem: I need to create a href link working like "back" button (I know this is not...
5
by: Brad | last post by:
I created a base page class which sets a response filter and the filter injects additional html into the response output stream. The filter works fine and everything works as expected except for...
1
by: Terry Olsen | last post by:
Is there any way to disable the client browser "Back" and "Forward" buttons while on my site? Or how would I go about knowing that a page hit is caused by a back/forward navigation? I have...
4
by: John | last post by:
Hi everybody, for my web-application (it must currently work only under IE6) I have a servlet that intercepts user's HTTP GET requests for a typical search result page, which contains a paging...
1
by: annir | last post by:
Hi Guys, I used VB.net 2005. In my project I used Drivelistbox, Dirlistbox and Filelistbox so that I can access the drives that I have. I have these problem about the back and forward button,...
0
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
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
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...
0
Oralloy
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.