Comboboxes

  • Thread starter Thread starter Steven Smith
  • Start date Start date
S

Steven Smith

2 more quick questions...

1) Is it possible to lock a combobox at runtime until a
predefined condition has been met(for example password /
username entered correctly) at which point it would allow
access to change the value in the combobox ? I would like
to do this without using enabled = true or false

2) Is it possible to assign a different color of text to
each item stored in the combobox?

Any help is greatly appreciated

Thanks in advance

Regards Steve
 
1) there are ways to do this ill give you 1
use a boolean flag to determine if your conditions are met (its always
false and when your conditions are met set it to true)
in the selected index changed event of the combo put an if structure
\\
if not blnControle then
combo.selectedindex = -1
end if
//

2) dont know
but i do know if you populate the combo w your own class that has a
overides to string parameter you get text of that class
it's possible that you can override the color 2 (this is one for the
experts ;) )


hope it helped
eric
 
What if you fill the combo after the password / username are entered
correctly is added rather than simply in the load event?

Not without ownerdraw - Which may be more effort than you want to extend.
An article on ownerdraw is here;
http://www.codeproject.com/vb/net/multicolumncombo.asp although it does not
do what you want you may garner the needed elements to make a better
decision regarding effort level needed vs ROI.

HTH,
Joe Johnston
www.gotboxer.com
 
* "Steven Smith said:
1) Is it possible to lock a combobox at runtime until a
predefined condition has been met(for example password /
username entered correctly) at which point it would allow
access to change the value in the combobox ? I would like
to do this without using enabled = true or false

Why not use 'Enabled = False'?
2) Is it possible to assign a different color of text to
each item stored in the combobox?

Ownerdrawn combobox...

You will find some samples in C# here, it's very similar in VB.NET:

<http://www.codeproject.com/cs/combobox>
 
Back
Top