Results 1 to 2 of 2

Thread: Aaron young re combolist index

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Calgary,Alberta, Canada
    Posts
    70

    Post

    hmm the code you gave me to use works ok as long as the sort property of the combo box is set to false when i change it to true the wrong price gets loaded in the index somehow gets mixed up any ideas on how to fix this or do i have to write subroutine to keep this from happening my post from two days ago

    ok lets see if i can word this correctly enough to make sense lets say i have a list of stuff in a flat file eg
    bread|2.50
    milk|1.50
    cheese|4.50 now i declared a array with this

    type TagStuff
    strStuff as string
    dblCost as double
    end type
    public S_taglist() as TagStuff
    I then only load the first part of the array
    into a combolist box that i have done ok no problems.Then when i select the text in the
    combo box it has to go to a flexgrid with two colums one for the strSuff and another
    for dblCost i not sure how to load the dblCost part of the array into the second columm so that when the text is added to the
    gird the PROPER cost of the item is added also
    Private Sub cmdAddList_Click()
    If cboList.Text = "" Then ExitSub

    grdItemSelect.Col = 1
    grdItemSelect.Row = intstuffCount + 1
    grdItemSelect.Text = cboList.Text
    grditemSelect.Col = 2
    grdItemselect.Text=????
    intStuffCount = intStuffCount + 1
    grdMovieSelect.Rows = intStuffCount + 2

    cboListText = ""


    ----------------
    Private Sub cmdAddList_Click()

    If ListIndex<0 Then Exit Sub 'You Can Add More Than One Column At a Time using Chr(9) 'Tab' As a Seperator
    grdItemSelect.AddItem cboList & Chr(9) & s_TagList(cboList.ListIndex).dblCost

    End Sub
    By the way nice homepage cool way to meet your wife too. you are gonna have to learn how to play 8-ball now, no more snooker
    i only play 8-ball now, our team usally wins a trip to vegas for the international 8ball
    tournement every year

  2. #2
    Guru Aaron Young's Avatar
    Join Date
    Jun 1999
    Location
    Red Wing, MN, USA
    Posts
    2,177

    Post

    The easiest way would probably be to store the Array Index Number in the ItemData Property of each Combo List Item, eg.

    sTagList(iIndex).strStuff = "Some Item"
    sTagList(iIndex).dblCost = 2.95
    Combo1.AddItem sTagList(iIndex).strStuff
    Combo1.ItemData(Combo1.NewIndex) = iIndex

    Code:
    Private Sub cmdAddList_Click()
        If cboList.ListIndex < 0 Then Exit Sub 
        grdItemSelect.AddItem cboList & Chr(9) & s_TagList(cboList.ItemData(cboList.ListIndex)).dblCost
    End Sub

    ------------------
    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]

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