How to add Items in a microsoft .net combobox

Posted by PeterWokke on 02-Sep-2014 09:31

I have defined a combo box in my form.

define private variable comboBoxRoles as System.Windows.Forms.ComboBox no-undo.

In a method I would like to re-fill this combobox.

First lclear it with:

comboBoxRoles:Items:Clear().
comboBoxRoles:ResetText().

In a for each tt-table a want to fill the combobox with add-first or add-last method.

I have tried several syntax but not the right one.

comboBoxRoles:Items:add-first(cDescription, tt-Table.GroupID).

comboBoxRoles::add-first(cDescription, tt-Table.GroupID).

Can someone help me.

The syntax help in PSDOE for these Microsoft Controls does not help much.

Where can you find syntax good syntax support for progress on those Microsoft Controls .

Thanks and regards,

Peter Wokke.

All Replies

Posted by Mike Fechner on 02-Sep-2014 09:43
You will never ever find methods with hyphens (minus/dash/ -) in the name in any .NET class – as that is an illegal character in .NET identifiers.
 
I don’t have too much experience with the plain ugly Microsoft Controls (I prefer the UltraControls) but the reference is here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox_methods(v=vs.110).aspx

or here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.items(v=vs.110).aspx

or here:

http://msdn.microsoft.com/en-us/library/system.windows.forms.combobox.objectcollection_methods(v=vs.110).aspx

 

Something like:

comboBoxRoles:Items:add(cDescription) .

 

 

 

 

Posted by PeterWokke on 03-Sep-2014 05:24

Mike,

I can use the UltraControls as well.

Does it has has the option to add first and add last.

I would like to set the default user role at the first entry in the ComboBox.

Thanks and regards,

Peter

Posted by Mike Fechner on 03-Sep-2014 05:27

Most collections have an Add that typically adds at the end and an Insert that allows to insert at any position you like – including 0.

Posted by PeterWokke on 03-Sep-2014 08:10

Thank you kindly Mike.

This thread is closed