Results 1 to 3 of 3

Thread: Newbie Needs Help on Arrays

  1. #1

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Hawaii
    Posts
    43
    The more I read into this the more I get confused.

    I want to take balloon orders so for one client I want to put the quantity, the color of the balloon, a message and the price.

    Quantity Color Message Price
    xx xx xx xx

    How do put this in an udt array that can't go over 10 orders per customer? The colors are in a combo box. And so are the messages except that if the customer doesn't like our messages we can type in the message he wants.

    I understand that the colors can go in an array and so can the message but what I don't understand is how the first order gets saved (in order for me to print the bill out after). Then I take the second order of balloons for the same customer, then the third, and so on, no more than 10 orders per customer. I can't seem to be tying in together.

    Private Type Balloon
    intQuantity(9) As Integer
    strColor(9) As String
    strMessage(9) As String
    curPrice(9) As Currency
    End Type

    Dim udtOrder(9) As Balloon
    Dim intCount As Integer

    picReport.Print "Customer Name: "; txtName.Text
    picReport.Print "Phone Number: "; txtPhone.Text
    picReport.Print "Quantity";
    picReport.Print Tab(13); "Size"; Tab(20); "Color";
    picReport.Print Tab(30); "Message"; Tab(50); "Price";
    picReport.Print Tab(2); udtQuantity(intCount).intQuantity

    For intCount = LBound(udtOrder) To UBound(udtOrder)
    With udtOrder(intCount)
    picReport.Print .intQuantity(9), Tab(10), .strColor(9), Tab(30), .strMessage(9), Tab(60), .curPrice(9)
    End With
    Next
    Printer.EndDoc

    And please explain slowly what I'm doing wrong.....I am a newbie and may not fully understand. I don't even know where to stick the above For With loop.


    Thanks for any type of guidance.
    Cynde

  2. #2
    jim mcnamara
    Guest
    If I understand what you want try using an array of udt instead of parking the array inside the type.

    Private Type Balloon
    intQuantity as integer
    strColor As String * 30
    strMessage As String *30 ' *30 is the length of each
    ' optional
    curPrice As Currency
    End Type

    Sub MySub()
    Dim Balloon_orders(1 to 9) as Balloon
    .....
    For x = 1 to 9
    reference each array eleemnt like this
    Balloon_orders(x).intQuantity ...
    Balloon_orders(x).strColor ....
    Balloon_orders(x).strMessage ...
    Balloon_orders(x).curPrice ...
    next x
    End Sub



  3. #3

    Thread Starter
    Member
    Join Date
    Feb 2001
    Location
    Hawaii
    Posts
    43
    Thanks, I'll try that. As you can see, I put a picturebox so I could see what the orders were. Is there any way to make the form (that the picture box is in) with a scroll bar? I can't get to the picbox - I have no way to see what's in it.
    Cynde

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