Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie
Hi there,
There is an issue with role permissions that is being worked on at the moment.
If you are having trouble with access or permissions on regional forums please post here to get access: https://www.boards.ie/discussion/2058365403/you-do-not-have-permission-for-that#latest

Quick VB Question.

  • 27-04-2004 6:42pm
    #1
    Closed Accounts Posts: 1,637 ✭✭✭


    Hi,

    I have question on list boxes, im trying to have 2 list boxes one with values e.g. "Car", "Boat" etc.. & the other as a number e.g. 5

    When I click on either the number or the item I want the number in the number list box to go down by 1.

    Please have a look @ the image to get what I mean.

    Thanks in advance Joe.

    list.JPG


Comments

  • Closed Accounts Posts: 1,637 ✭✭✭joePC


    heres what I got so far:

    Private Sub List1_Click()

    Count = List2.Index

    If List2.List(Count) = 1 Then

    MsgBox "Item out of stock"

    End If

    If List2.List(Count) = 0 Then

    Exit Sub

    End If

    List2.List(Count) = List2.List(Count) - 1

    End Sub


  • Closed Accounts Posts: 1,637 ✭✭✭joePC


    OK get it sorted:

    [PHP]

    Private Sub List1_Click()

    DecrementStock List1.ListIndex

    End Sub

    Private Sub List2_Click()

    DecrementStock List2.ListIndex

    End Sub

    Public Sub DecrementStock(Count As Integer)

    If List2.List(Count) = 1 Then
    MsgBox "Item out of stock"

    End If
    If List2.List(Count) = 0 Then
    Exit Sub
    End If
    List2.List(Count) = List2.List(Count) - 1

    End Sub

    [/PHP]


Advertisement