Click here to Skip to main content
15,891,943 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to display none in the combobox
please suggest me it should be done in the code or can i set the combo box proplerties
Posted
Comments
F. Xaver 25-Nov-13 10:08am    
I wonder what "none" is?
Member 10424744 25-Nov-13 12:19pm    
when we select somethg in dropdown box for eg : selecting A,B,C D .IN THE COMBBOX IT SHOULD NONE,A,B,C,D...

1 solution

If you want to display none in ComboBox, in Properties Panel you can set Text Properties to none. The other way of changing it to none is by adding the below line in Form Load Event.
VB
ComboBox1.Text = "none"

The above code will help you to display none when you run your form. But it will not be displayed in the item list of your ComboBox. If your want it to be displayed in your list too, then you can right click on your ComboBox and click on Edit Items... A new window will get opened. Add none in the textbox there. Other way of adding none to the list is adding the below line in the Form Load Event.
VB
ComboBox1.Items.Add("none")

Hope this satisfy your question. If still you have any doubt you can post it in comments.
 
Share this answer
 
v2
Comments
Member 10424744 25-Nov-13 10:24am    
its showing in the combobox now , but when i click it s not show in dropdown and if i select none i should write code for displaying none what should i write and where
Irfan Project 25-Nov-13 10:57am    
Simply you can insert two lines in the Form Load Sub

Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ComboBox1.Text = "none"
ComboBox1.Items.Add("none")
End Sub
Member 10424744 25-Nov-13 11:05am    
still its not showing in the dropdown ,just its displaying in the combbox , ia m not able to select none ,other data is coming from database but i wan to select none , its not what shall i do
Member 10424744 25-Nov-13 11:10am    
Public Sub LoadClusterInfo(ByVal clusterID As String, ByVal operation As OperationEnum, ByRef entities As RFDBEntities)
entities = New RFDBEntities
_clusterID = clusterID
_entities = entities
_operation = operation
_securityStatus = security.GetInstance.isDesigner Or security.GetInstance.isApprouver
If _securityStatus = False Then
If security.GetInstance.isAdmin Then
_securityStatus = True
End If
End If
cboHostsiteId.Text = "None"
cboHostsiteId.Items.Add("None")

SelectSecurity(_securityStatus)

FillFormCluster()
Member 10424744 25-Nov-13 12:16pm    
Please tell me what to do . i sent my code please check

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900