Dear,
i want add the new item in combobox at run time,whiout databas.
i want user enter the new item in comobox.
plese help me

Use form load event to add stuff at runtime.

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'add items in combobox here at runtime

    End Sub

"i want user enter the new item in comobox." Sorry, I only speak English, and don't know what that means.

Try this

Private Sub Combo1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Combo1.KeyPress

If e.KeyChar=Chr(Keys.Enter) Then
   Me.Combo1.Items.Add(Me.Combo1.Text) 'Any text entered into the combobox text will be added into the combobox item list after hiting Enter Key
End If

End Sub

Use form load event to add stuff at runtime.

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

'add items in combobox here at runtime

    End Sub

"i want user enter the new item in comobox." Sorry, I only speak English, and don't know what that means.

Frined,
i want Enter new item at run time.your coad is not work.
you chake it

Try this

Private Sub Combo1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Combo1.KeyPress

If e.KeyChar=Chr(Keys.Enter) Then
   Me.Combo1.Items.Add(Me.Combo1.Text) 'Any text entered into the combobox text will be added into the combobox item list after hiting Enter Key
End If

End Sub

Brother;
This coad add the item in combobox but temporary add,wen i close the form thes item will be remove ok,
Are you Pike my point????

Helpe me Brother On my Topic.

If any Brother solve my Problam i thank it very

Brother;
This coad add the item in combobox but temporary add,wen i close the form thes item will be remove ok,
Are you Pike my point????

if that is ur case..u need to conenct it to database and fetch the datas everytime u load ur form... if u add it like items.add it is for temp time till u close the form.... or id u want to be u can add the items in the form load event so everytime u load the form...the items will be there..


Cheers

Xulu

Brother i want this work whitout databas.if i conenct the data bas i Know this but i want without data bas.ok

Hi Sister..

I can understand ur point but without database u cant finish ur task...
Adding items in form load will be a temprory thing but from database u can do that...

i guess you cannot store permanently any inputed texts into the combobox item list at runtime UNLESS you decide to have a database or if you load it first at design time.

If you want a permanent data to be loaded in your combobox then go for a database, there, you can add, subtract anytime you want.

i hope somebody could help you solve your problem..

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.