Visual Basic Code , VB.NET Code, VB Code
  Home   :  Code   :  Forums   :  Submit   :  Mailing List   :  About   :  Contact


Previous Next Buttons


Previous Next Buttons

Author
Message
shers
shers
Forum God
Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)Forum God (16K reputation)

Group: Forum Members
Posts: 66, Visits: 170
Hi,

I have some images that has to be displayed on a form from a dynamic folder using control array. The controls display 5X3, that is 15 images on one form. How do I display the next set of images using Next button, and go back to the previous set using the Previous button, if there are more than 15 files in the folder.

Thanks

TallOne
TallOne
Forum God
Forum God (50K reputation)Forum God (50K reputation)Forum God (50K reputation)Forum God (50K reputation)Forum God (50K reputation)Forum God (50K reputation)Forum God (50K reputation)Forum God (50K reputation)Forum God (50K reputation)

Group: Forum Members
Posts: 370, Visits: 212
You could use a datagrid or repeater control.  These have paging capabilities and can display images.  Or build your custom methods using the fileinfo class and iterating the collection.  Heck you might even be able to use the fileinfo class as a datasource to bind to a datagrid! Come up with some code and I give you a hand.

Good Luck

TallOne

amanz90
amanz90
Forum God
Forum God (717 reputation)Forum God (717 reputation)Forum God (717 reputation)Forum God (717 reputation)Forum God (717 reputation)Forum God (717 reputation)Forum God (717 reputation)Forum God (717 reputation)Forum God (717 reputation)

Group: Forum Members
Posts: 3, Visits: 13
hi,

my next button works on the second click...eg:if i click next the page will just reload and then i click anything else on the page then the next button works

same for previous.... really need some help

this is the code i have

----------------------------------------------------------------------------------------------------------------------







Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not IsPostBack Then

p = 0

Session("p") = p 'p

End If

nsi = Session("nsi") 'no of images

lp = nsi / 15 'last page

Session("lp") = lp

pagechk()

p = Session("p")

lblpn.Text = p & "/" & lp

display()



End Sub



Dim j, x(15) As Int32



Private Sub pagechk()

lp = Session("lp")

p = Session("p")

If p = lp Then

btnnext.Enabled = False

btnprv.Enabled = True

If p > 0 Then

btnprv.Enabled = True

Else

btnprv.Enabled = False

End If

Else

btnnext.Enabled = True

If p > 0 Then

btnprv.Enabled = True

Else

btnprv.Enabled = False

End If

End If

End Sub



Private Sub display()

p = Session("p")

j = p * 15

For i As Int32 = 1 To 15

j += 1

x(i) = j

Next

imgsuits1.ImageUrl = "~/images/Suits thumbs/p" & x(1) & ".jpg"

imgsuits2.ImageUrl = "~/images/Suits thumbs/p" & x(2) & ".jpg"

imgsuits3.ImageUrl = "~/images/Suits thumbs/p" & x(3) & ".jpg"

imgsuits4.ImageUrl = "~/images/Suits thumbs/p" & x(4) & ".jpg"

imgsuits5.ImageUrl = "~/images/Suits thumbs/p" & x(5) & ".jpg"

imgsuits6.ImageUrl = "~/images/Suits thumbs/p" & x(6) & ".jpg"

imgsuits7.ImageUrl = "~/images/Suits thumbs/p" & x(7) & ".jpg"

imgsuits8.ImageUrl = "~/images/Suits thumbs/p" & x(8) & ".jpg"

imgsuits9.ImageUrl = "~/images/Suits thumbs/p" & x(9) & ".jpg"

imgsuits10.ImageUrl = "~/images/Suits thumbs/p" & x(10) & ".jpg"

imgsuits11.ImageUrl = "~/images/Suits thumbs/p" & x(11) & ".jpg"

imgsuits12.ImageUrl = "~/images/Suits thumbs/p" & x(12) & ".jpg"

imgsuits13.ImageUrl = "~/images/Suits thumbs/p" & x(13) & ".jpg"

imgsuits14.ImageUrl = "~/images/Suits thumbs/p" & x(14) & ".jpg"

imgsuits15.ImageUrl = "~/images/Suits thumbs/p" & x(15) & ".jpg"

End Sub



Protected Sub btnprv_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnprv.Click

p = Session("p")

p = p - 1

Session("p") = p

Session("bt") = 1

End Sub



Protected Sub btnnext_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnnext.Click

p = Session("p")

p = p + 1

Session("p") = p

Session("bt") = 1

End Sub



Protected Sub Page_Unload(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Unload

If Session("bt") = 1 Then

Session("bt") = 0

Else

Session("p") = 0

Session("bt") = 0

End If

End Sub


GO


Similar Topics


Reading This Topic


Login
Existing Account
Email Address:


Password:


Social Logins

Select a Forum....

















A1VBCode Forums


Search