Uneditable Text in ComboBox VB.net

Tuesday, June 11, 2013 Posted by Glenn Von Posadas

Article by: Glenn Posadas

If your program has a combo box and any user can edit or input something in such object, then your program may not look professional.

There are four types of combo boxes you may want to put in your form:

1. The Normal one - you can see the list inside the object but you can input anything. Not so cool, especially if you are developing a serious project.

2. Enabled/Disabled Combo Box - if you set the enable property to false, obviously you can't input anything, and you can't even click it.

3. DropDown Style Property Combo Box - if you set its dropdown style property to dropdown list, err, its color will be uneditable too and it can't have a text to display in running time. Also, I am currently developing a system for this coming june, it is for the registration in our organization, and I was having a real trouble in finding a solution in my combo box. I want it to look professional. I can't have this DropDown Style shit set to List, because its color is not good, and its obvious that its design doesn't fit to my form style.

4. The Normal but uneditable Combo Box - Finally! This is the best type of combo box that I can put in my program.The color is good and changeable and it is uneditable.

There are lots of ways to make your normal combo box uneditable. But I'm gonna show you the easiest one.

Okay here it is: Put e.Handled = True inside the KeyPress event of your Combo Box.

How to do this (noob haha),
1. Go to the Design Form.
2. Double click the Combo Box
3. Click at the middle field of the code (SelectedIndexChanged), and
4. Select the method name above (this has the thunder sign) and find KeyPress, finally put the code I've given above.

additional tags: uneditable text in combobox in visual c#, visual basic.net, vs 2005, read only combo box, how to disable edit in combo box, how to make combo box uneditable without dropdown list, no dropdown list, readonly

glenn von

Author: Glenn Posadas

20 year old 5th year Computer Engineering Student, a blogger, photographer, programmer, and an electronics hobbyist; a Christian who loves God very much..

Sharing is so Easy:
StumpleUpon DiggIt! Del.icio.us Blinklist Yahoo Furl Technorati Simpy Spurl Reddit Google Twitter FaceBook

Labels: , ,

Post a Comment

Drop a comment. Thank you guys!