DouglasBell
Active member
- Joined
- Aug 16, 2011
- Messages
- 38
- Programming Experience
- Beginner
Hi All
I am using the XmlSerializer to create an array of items
Once created I am using a For Each Loop to go through these items. Buttons are created based on these items.
This is great as long as there is less than 10 items as I can only have 10 buttons on my screen, so what I am wanting to do is create back and next buttons that will change the buttons based on how many is in the list.
For example each page would be 10 items, so to work out the number of pages I would do. Math.Ceiling(items / 10). So if I had 19 items this would give me 2 pages, Page 1 would display items 1 - 10 Page 2 would display items 11 - 19, you would scroll through the pages using the back and next buttons.
How can I modify my For Each loop to only display the items based ont he current page?
Cheers
DJ[/INDENT]
I am using the XmlSerializer to create an array of items
Once created I am using a For Each Loop to go through these items. Buttons are created based on these items.
VB.NET:
For Each node As MyNode In myNodes
Dim btn As New Button()
With btn
.Size = New Size(464, 108)
.BackColor = Color.FromKnownColor(KnownColor.ControlLight)
.FlatStyle = FlatStyle.Flat
.FlatAppearance.BorderSize = 2
.Font = New System.Drawing.Font("Century", 21.75)
.TextAlign = ContentAlignment.MiddleLeft
.Margin = New Padding(124, 20, 0, 0)
.Text = node.Text
.Tag = node.Nodes
End With
AddHandler btn.Click, AddressOf DynamicButton_Click
buttonsFlowLayoutPanel.Controls.Add(btn)
Next
This is great as long as there is less than 10 items as I can only have 10 buttons on my screen, so what I am wanting to do is create back and next buttons that will change the buttons based on how many is in the list.
For example each page would be 10 items, so to work out the number of pages I would do. Math.Ceiling(items / 10). So if I had 19 items this would give me 2 pages, Page 1 would display items 1 - 10 Page 2 would display items 11 - 19, you would scroll through the pages using the back and next buttons.
How can I modify my For Each loop to only display the items based ont he current page?
Cheers
DJ[/INDENT]