CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: parallel arrays

  1. #1
    Join Date
    Feb 2000
    Posts
    4

    parallel arrays

    I need to place products and unit price in a list box straight across from each other as follows:
    product1 $4.99
    product2 $5.99 etc....

    Both products and prices are in two separate arrays. how do I print them so the price is next to the product... someone please help... my code in form load follows... thanks.


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: parallel arrays

    Try this:
    private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (byval hwnd as Long, byval wMsg as Long, byval wParam as Long, lParam as Any) as Long
    private Const LB_SETTABSTOPS = &H192

    private Sub Form_Load()
    Dim iIndex as Integer
    Dim aTabs(0) as Long
    aTabs(0) = 70
    Call SendMessage(List1.hwnd, LB_SETTABSTOPS, 1, aTabs(0))
    for iIndex = 1 to 10
    List1.AddItem "Product" & iIndex & Chr(9) & Format(Rnd * 100, "$##.##")
    next
    End Sub


    Replacing the Sample Data with the Products and Prices from your Arrays, when you read the Values back from the List, the Product and Price with be seperated by a Tab, (Chr(9)).

    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Certified AllExperts Expert: http://www.allexperts.com/displayExp...p?Expert=11884
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Feb 2000
    Posts
    4

    Re: parallel arrays

    great...thank you...


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

Featured