![]() |
manipulating controls
I have a bunch of comboboxes i would like to set the values to before my form
loads based on how big a range is but i want to be able to run through all combo boxes with having to write a block for each ...... using some code i seen in a book i wrote this and thought that this might work ... any suggestions Dim mycontrol As Control Load ISBN For Each mycontrol In Controls If Left(mycontrol.Name, 5) = "Combo" Then For Fill = 0 To a - 1 With mycontrol Dim nextitem As Integer nextitem = 65 + Fill .AddItem Chr(nextitem) End With Next Fill End If Next ISBN.Show |
manipulating controls
I think it would depend on what you want each combobox set to.
If you always want the first item in the list, you could change each of the ..listindex properties to 0. If you wanted something more complex, it might make more sense to just populate each combobox with the value you want. Robin Krupp wrote: I have a bunch of comboboxes i would like to set the values to before my form loads based on how big a range is but i want to be able to run through all combo boxes with having to write a block for each ...... using some code i seen in a book i wrote this and thought that this might work ... any suggestions Dim mycontrol As Control Load ISBN For Each mycontrol In Controls If Left(mycontrol.Name, 5) = "Combo" Then For Fill = 0 To a - 1 With mycontrol Dim nextitem As Integer nextitem = 65 + Fill .AddItem Chr(nextitem) End With Next Fill End If Next ISBN.Show -- Dave Peterson |
All times are GMT +1. The time now is 09:53 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com