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!

Populate Combo box or Different Combo box

Status
Not open for further replies.

muraliambt

Programmer
Jan 22, 2002
75
0
0
US
Hi,

I have Flexgrid with 18 cols. I am using one combo box and one text box to make the grid editable.

For 12 cols iam using Combo and rest Text Box.

I am pouplating Combox box every time when it enters the respective column. Example.

col 1 = Fill the Combo Box with Product Code.
col 3 = Fill the Combo Box with Branch Code.
col 5 = Fill the combo box with Party Code.
etc...

When the user selects the code then i am displaying the respective name in the Next Column. like COL 2, COL 4,
COL6, Etc..

1. Is there any other Better Way to Do this ?

2. It is a good practice to have single combo box and populate for every column or Should i have different Combo Box for Different columns and populate the combo while starting the form itself.

Thanks...
Muraliambt.



 
Have a Single Combo Control Array instead of having 12 different physical Combo boxes.

HTH

Engi
 
Hi,

Can u give me example code for Single combo Control Array.

Right now i am populating single combo every time based on the column.

Muraliambt.
 
A Control array is an array of combobox controls. (Search this site or use VBHelp for Control Arrays). They all have the same name but different Index values. The array will have 12 members. You will have common code for them all, so you will choose the data to load based on the Index value.

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

For tsunami relief donations

'If we're supposed to work in Hex, why have we only got A fingers?'

for steam enthusiasts
 
muraliambt,

<<
I have Flexgrid with 18 cols. I am using one combo box and one text box to make the grid editable.
>>
So when you navigate to a cell in Flexgrid the single textbox or single combo appear over that cell and lets you edit it. That is a good way to do it I think although the coding can be a little tricky. You should'nt need multiple (control arrays of) textboxes and/or combos.

<<
2. It is a good practice to have single combo box and populate for every column or Should i have different Combo Box for Different columns and populate the combo while starting the form itself.
>>
This depends on how long it is taking to populate the combo each time you move to a different column, if its slow the user interface will become slow too, in that case a control array of combos (one for each column requiring one) populated in Form_Activate or Load may be better.

regards Hugh,


regards Hugh
 
Hi Hugh,

Thanks for the nice suggestions.

Right now i don't face any problem or slow down in populating the combo box. May be later if more records are added to the tables.

what is maximum records i can populate to combo box so that i should not feel the slow ?

Muraliambt.
 
muraliambt,

You'll know when its slow!

It depends mostly on where you are getting the data from to populate the combo. If you are populating from an array of strings in memory or another control for example the process will be very quick, if you are populating from a database or disk file the process may be slower.
In either case unless you have hundreds of rows I expect it'll be quick enough. Its not good practice to have so many rows in a combo anyway, in such case you could limit the options in Product for example by making the user select a 'Product Type' first.

regards Hugh

regards Hugh
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top