|
-
Jan 9th, 2002, 09:52 AM
#1
Thread Starter
Member
How do I refresh a page?
I'm working on a program that has a catalogue and a basket that users can fill up. I have one form that displays all items in the basket. The user can click on a certain item, then on remove to take an item ut of the basket. I would like to refresh the page so that after clicking on 'remove', the list of items in the basket is automatically updated. I tried using Me.Refresh, but this doesn't work. Is there something else I can do?
Here's what I've done:
Private Sub cmdRemoveItem_Click()
x = lbItemNum(Index)
eraseItem x
End Sub
Private Sub eraseItem(ByVal itemNum As Long)
Dim i As Long
For i = itemNum To UBound(cart) - 1
cart(i) = cart(i + 1)
Next
ReDim Preserve cart(UBound(cart) - 1)
z% = UBound(cart)
End Sub
This is the code that fills in the labels :
Private Sub Form_Load()
tot = 0 'remet tot à 0 à chaque affichage de la page au cas ou erase à été appelé
' doit faire gestion de pages (+ que 10 articles)
If Not z% = 0 Then 'voir panier vide
For y% = 0 To (z% - 1)
lbNum(y%).Caption = y% + 1
lbItemNum(y%).Caption = Str$(cart(y%).itemNum)
lbItemName(y%).Caption = cart(y%).ItemName
lbPrice(y%).Caption = CStr("$ " & cart(y%).Price)
lbColor(y%).Caption = cart(y%).Color
lbSize(y%).Caption = cart(y%).Size
lbQty(y%).Caption = cart(y%).Nbr
lbItemTot(y%).Caption = CStr("$ " & cart(y%).ItemTot)
tot = tot + cart(y%).ItemTot
Next y%
lbSubTot = CStr("$" & tot)
End If
End Sub
-
Jan 9th, 2002, 10:02 AM
#2
Try this:
VB Code:
Private Sub cmdRemoveItem_Click()
x = lbItemNum(Index)
eraseItem x
[b]call Form_load[/b]
End Sub
-
Jan 9th, 2002, 11:19 AM
#3
Thread Starter
Member
Sounded like a good idea, but that didn't work either. Any other ideas???
-
Jan 9th, 2002, 11:25 AM
#4
Frenzied Member
-
Jan 9th, 2002, 11:30 AM
#5
Thread Starter
Member
Close, but no cigar. When I do this, the screen kind of blinks when I click on the remove button, but the information on the page still stays the same. I'm stumped.
-
Jan 9th, 2002, 11:33 AM
#6
Thread Starter
Member
Ok, I found something that works, but it seems rather unconventional.
Private Sub RemoveItem_Click()
x = lbItemNum(Index)
eraseItem x
Unload Basket
Basket.Show
End Sub
I guess whatever work, right?
Anyway, thanks for the suggestions.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|