Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

variable amount of rows on userform

Status
Not open for further replies.

hcvink

Technical User
Feb 17, 2010
11
NL
Hi all,

I have a userform which will display information regarding orders. These orders are in the amount of 100+. I want to display all the orders and the needed information on the userform. To get an idea:

Order id 1 Orderitem 1 Orderitem 2 Orderitem 3
Order id 2 Orderitem 1 Orderitem 2 Orderitem 3
Order id 3 Orderitem 1 Orderitem 2 Orderitem 3
Order id 4 Orderitem 1 Orderitem 2 Orderitem 3
.
.
.
Order id x Orderitem 1 Orderitem 2 Orderitem 3

Taking the amount of orders into account. What is the best way to proceed?

I saw the posibility to add Microsoft Office Spreadsheet 10.0 or 11.0. to the userform, but I can not find information regarding these online.

Can someone point me in the right direction?
 
For one moment I had a WHOOAAA!!! but...

I might have forgotten to mention that I have excel. The MS FlexGrid 6.0 is available as a control on one of the machines I have. When I try to add it there it gives me an error saying: The subject is not trusted for the specified action.

On my other system I could not find the control in the list.

I am not able to change the configuration of both systems to make it work so is there another option?
 
And what happens when you browse to System32 and add MSFlxGrd.ocx as a reference?
 
also if interested:
thread707-1530759
 
I do not have access to the System32 folder due to restrictions. I neither have the authorisation to install applications on my workpc's.

I found the link you posted, but since I am not able to change anything on my work pc's.........

thanks for the effort though...:)
 
Sorry I read too much into the original. Why not simply use a native control like a listbox?
 
No problem.

I am trying to create an overview of orders with statusses. If I use listboxes they would not have the overview on all orders. Since there seems to be no other option I am going for textboxes.

Should not be too hard to dynamicly add those to a userform.
 
What about two linked lists? One can be filled with order IDs, the second with order items. The Change event of the first list can fill the second one. An easy handling of variable nubber of orders is the advantage of this solution.

combo
 
I am wondering, could this not lead to extraordinary number of textbox controls on the userform?

PLUS, textbox are for user input, NOT to display text.

It seems to me that if the user is not going to be inputing anything...use Labels. That is what they for.

Gerry
 
If I use listboxes they would not have the overview on all orders
Wouldn't a multiple-column ListBox work?
Code:
Private Sub UserForm_Initialize()
    Dim ix As Integer
    
    With ListBox1
    
        .ColumnCount = 4
        .ColumnWidths = "72pt;72pt;72pt;72pt"
        
        For ix = 1 To 9
            .AddItem "Order Id" & ix
            .List(.ListCount - 1, 1) = "OrderItem" & ix & "1"
            .List(.ListCount - 1, 2) = "OrderItem" & ix & "2"
            .List(.ListCount - 1, 3) = "OrderItem" & ix & "3"
        Next
        
    End With

End Sub
 
Fumei,

this wil iindeed lead to a lot of textboxes. Your idea to use labels is a good one. I will change it to labels.

I already noticed that The loadtime is high when using textboxes.

It is not The idea to have people select anything in that part of ghe userform. I want to display all orders or orders based on à filter somwhere else on the userform.

Always interested in more information. Newby here and wanting to learn.

 
Again, why would you not simply use a multi column listbox, or listview. I can not see how dynamically adding labels could give you a better visual than simply a listbox? This looks to me like a listbox:

Order id 1 Orderitem 1 Orderitem 2 Orderitem 3
Order id 2 Orderitem 1 Orderitem 2 Orderitem 3
Order id 3 Orderitem 1 Orderitem 2 Orderitem 3
Order id 4 Orderitem 1 Orderitem 2 Orderitem 3
.
.
.
Order id x Orderitem 1 Orderitem 2 Orderitem 3
 
MajP,

Your persistence made me check the posibilities of the multi column listbox. I had the idea that listboxes used dropdowns. But they don't. I am currently changing it to listboxes as we speak and it is exactly what I need.

Thanks for being persistent :) And thanks to DaveInIowa for the example!


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top