Windows Develop Bookmark and Share   
 index > Windows Forms Designer > About combo box.
 

About combo box.

Hi,
I have just competed my BCA Degree, and i have intermediate hand in vb.net. I faced a problem while i was building an windows application for stock management and that was, i retrieve the data from database and inserted it into combo box. But now, I want that the combo box should be read only. The user could only select the available options from the combo box. I tried very much to do so, but i couldn't find this property at all. So, please help me, and write me how it could be possible? And i want to know one more thing that, how could we save any value in the windows registry and retrieve the saved value through windows application
Bhuwan Chandra Arya  Wednesday, August 12, 2009 11:08 AM
Ok, I have a solution if you just want the user to be able to use those values. before any action, you could put a checK:

if (comboBox1.Items.Contains(comboBox1.Text))
 {
///the action to perform
 }
else 
{ 
MessageBox.Show("The specified value is not allowed.");
 }

Regards,
Haris Umer

.::AlwayX A LearneR::.
Haris Umer  Wednesday, August 12, 2009 11:18 AM
Hi,
For read only combobox set combobox properties dropdownstyle as DropDownList.
for registry this link will may help you
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/4f4de17b-9b91-4610-9b64-121f224f3747/
i hope it will help you
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Wednesday, August 12, 2009 12:30 PM

In code you can do this:



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
    End Sub

Only performance counts!
Sylva  Thursday, August 13, 2009 7:09 PM
Ok, I have a solution if you just want the user to be able to use those values. before any action, you could put a checK:

if (comboBox1.Items.Contains(comboBox1.Text))
 {
///the action to perform
 }
else 
{ 
MessageBox.Show("The specified value is not allowed.");
 }

Regards,
Haris Umer

.::AlwayX A LearneR::.
Haris Umer  Wednesday, August 12, 2009 11:18 AM
Hi,
For read only combobox set combobox properties dropdownstyle as DropDownList.
for registry this link will may help you
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/4f4de17b-9b91-4610-9b64-121f224f3747/
i hope it will help you
Best Regards, C.Gnanadurai ----------------------- Please mark the post as answer if it is helpfull to you
Gnanadurai  Wednesday, August 12, 2009 12:30 PM

In code you can do this:



    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ComboBox1.DropDownStyle = ComboBoxStyle.DropDownList
    End Sub

Only performance counts!
Sylva  Thursday, August 13, 2009 7:09 PM

You can use google to search for other answers

Custom Search

More Threads

• cloning a listview
• Code persist bug
• How to display SmartTags/DesignerVerbs in a home made DesignerHost
• Form.designer separated from its form file
• Generic Classes & Forms Designer
• combo box like textbox
• Invoking VB6 from Smart client applications using Composit UI application Block
• Form Designer does not load. How to solve?
• Can one use glyphs to manage user-interface with something other than a full-feldged control
• Splash Screen Controls becoming transparent at load time.