Monday, 15 March 2010

vb.net - loop through all comboboxes with specific name -



vb.net - loop through all comboboxes with specific name -

is possible loop through comboboxes specific name. illustration have 25 comboboxes in groupbox need loop through 20 of them (each of 20 have name special_combo_1,special_combo_2 , etc. 5 have names need leave are)and alter width @ 1 time or alter text or else.

you can utilize control.controls controls groupbox contains. then, should cast each control object combobox type using trycast(object, object). can check prefix string.startswith(string).

for each item command in groupbox1.controls dim comboboxitem combobox = trycast(item, combobox) if comboboxitem isnot nil if comboboxitem.name.startswith("special_combo_") ' code here end if end if next

vb.net

No comments:

Post a Comment