Results 1 to 6 of 6

Thread: How do I refresh a page?

  1. #1

    Thread Starter
    Member
    Join Date
    Dec 2001
    Location
    Belgium (school), California (home)
    Posts
    59

    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

  2. #2
    Si_the_geek
    Guest
    Try this:
    VB Code:
    1. Private Sub cmdRemoveItem_Click()
    2.  
    3. x = lbItemNum(Index)
    4. eraseItem x
    5. [b]call Form_load[/b]
    6.  
    7. End Sub

  3. #3

    Thread Starter
    Member
    Join Date
    Dec 2001
    Location
    Belgium (school), California (home)
    Posts
    59
    Sounded like a good idea, but that didn't work either. Any other ideas???

  4. #4
    Frenzied Member vbgladiator's Avatar
    Join Date
    May 2001
    Posts
    1,950
    How about Form.Refresh

  5. #5

    Thread Starter
    Member
    Join Date
    Dec 2001
    Location
    Belgium (school), California (home)
    Posts
    59
    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.

  6. #6

    Thread Starter
    Member
    Join Date
    Dec 2001
    Location
    Belgium (school), California (home)
    Posts
    59
    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
  •  



Click Here to Expand Forum to Full Width