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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dynamic controls 1

Status
Not open for further replies.

azrobert

Programmer
Apr 27, 2002
392
0
16
US
Hello all,

I did a quick search and didn't find what I was looking for. I currently have a few (8) command buttons on a form representing Product Locations, I would like to be able to look at the database and generate command buttons for each location in the database rather than hard code them (locations may vary at future installs) any ideas on where to start..... I am looking to load a flexgrid bassed on the button selected and have only buttons for the current locations in the database. right now I am using a combo box to lis tthe locations but i think it would be more user friendly to create buttons for each location......



amazing how you can write a great program and then have the idiots that run it offer better solutions than you thought of at the time you wrote it.....
 
You need a Control Array. A quick search on this forum gives several results, including thread222-1172689

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first.
'If we're supposed to work in Hex, why have we only got A fingers?'
Drive a Steam Roller
 
Thanks, will give that a look later today :)
 
Hi,

The button-solution isn't very flexible:

If you have for example 1000 Locations, they wouldn't fit on your form. A Grid or Combo-Box would be "ScaleAble"

If your number of locations are limited to n locations:

Place n buttons (control-array) on your form.
Make the unnecessary buttons invisible and resize the form from code so that the arent big empty areas of your form.

SmallTalker
 
I agree with SmallTalker that the button solution isn't very scaleable. If you don't like the Combo Box, and you want to have the best of both worlds, you might look into the DataRepeater control. While it's not generally well-liked in the VB6 community (and not unreasonably), I do have one successful production application that uses it.

The DataRepeater would allow you to create a scrollable set of command buttons. If you should desire to go to the trouble, perhaps you will investigate it.

HTH

Bob
 
Thanks for both solutions,

I will look in to them... for now the dynamic buttons is working great for this particular application. there will never be more than 14 buttons at any location and it seems to be doing the trick. I can easly see where it won't work in other applications though.
 
Yeah, 14 is manageable. I wouldn't use a DataRepeater for that.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top