Hi ,
oCombo.DisplayLayout.Grid.Rows[0].Cells[0].Column.PerformAutoResize();
On this code I get a runtime error telling me the index is outside the bounderies.
Any help is appreciated!
regards,
Erik
Hi Erik,
How about:
ultraCombo1.DisplayLayout.Bands[0].Columns[0].PerformAutoResize();
Andy.
Hi Andy,
Thanks for your answer.
Any other suggestions?
In what event are you calling this function?
Andy Jones said:ultraCombo1.DisplayLayout.Bands[0].Columns[0].PerformAutoResize();
Additionally, is the combo's DataSource set before you call this method?
The exception means that there was either a problem retrieving the band (unlikely since the combo auto-generates band 0) or the column.
Vince McDonald"]In what event are you calling this function?
It is not called in an event, it is called during initializing the (datadriven) form.
Vince McDonald"]Additionally, is the combo's DataSource set before you call this method?
Yes it is. See my code below. Any suggestions?
{
Infragistics.Win.
}
cPortUser said:It is not called in an event, it is called during initializing the (datadriven) form.
My first suggestion is to move this call until after you've added the control to the appropriate Controls collection:
// oCombo.DisplayLayout.Bands[0].Columns[0].PerformAutoResize();oCombo.TabIndex = Counter;base.Controls.Add(oCombo);oCombo.DisplayLayout.Bands[0].Columns[0].PerformAutoResize();
If that still isn't late enough, move the call to your Form_Shown event handler.
Also, you probably need to call the overload of PerformAutoResize that takes an enum and specify AllRowsInBand. Otherwise, you are sizing based only on the visible rows and in this case, there will be no visible rows until the list is dropped down at least once.
Thanks Vince and Mike.
The hint Vince submitted did the trick get rid of the runtime error and the addition of Mike resulted in the wanted behaviour.
Thanks for great support and a great product!