473,387 Members | 1,313 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

add item to comboBox

Hi, All,

when starting run app, how to let user add item/edit item to comboBox on the
Form,

Thanks,
Martin
Nov 14 '07 #1
4 2407
I'm not sure how you initially fill the combobox, but the user can add items
like the following and then tie in with list or database at the same time.

Lennart

Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Enter And ComboBox1.Text IsNot Nothing Then

ComboBox1.Items.Add(ComboBox1.Text)

ComboBox1.Text = Nothing

End If

End Sub

"martin1" <ma*****@discussions.microsoft.comwrote in message
news:4F**********************************@microsof t.com...
Hi, All,

when starting run app, how to let user add item/edit item to comboBox on
the
Form,

Thanks,
Martin

Nov 15 '07 #2
hi, Lennart,

Thanks. One more question - after add there, how to edit/remove item from
list?

Martin

"Lennart Nielsen" wrote:
I'm not sure how you initially fill the combobox, but the user can add items
like the following and then tie in with list or database at the same time.

Lennart

Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Enter And ComboBox1.Text IsNot Nothing Then

ComboBox1.Items.Add(ComboBox1.Text)

ComboBox1.Text = Nothing

End If

End Sub

"martin1" <ma*****@discussions.microsoft.comwrote in message
news:4F**********************************@microsof t.com...
Hi, All,

when starting run app, how to let user add item/edit item to comboBox on
the
Form,

Thanks,
Martin


Nov 15 '07 #3
Martin,

As far as I know, your only choice is to do those as separate operations.
You can for example use a right-click on the combobox to open a
contextmenustrip with an Edit and a Delete item.

With the delete item you can do combobox1.items.remove(combobox1.text).

Editing an item could be a two-step function where you "edit" the item in a
userbox, then delete the original and replace it with the edited version.

Lennart
"martin1" <ma*****@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
hi, Lennart,

Thanks. One more question - after add there, how to edit/remove item from
list?

Martin

"Lennart Nielsen" wrote:
>I'm not sure how you initially fill the combobox, but the user can add
items
like the following and then tie in with list or database at the same
time.

Lennart

Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Enter And ComboBox1.Text IsNot Nothing Then

ComboBox1.Items.Add(ComboBox1.Text)

ComboBox1.Text = Nothing

End If

End Sub

"martin1" <ma*****@discussions.microsoft.comwrote in message
news:4F**********************************@microso ft.com...
Hi, All,

when starting run app, how to let user add item/edit item to comboBox
on
the
Form,

Thanks,
Martin



Nov 16 '07 #4
Thank you
Martin

"Lennart Nielsen" wrote:
Martin,

As far as I know, your only choice is to do those as separate operations.
You can for example use a right-click on the combobox to open a
contextmenustrip with an Edit and a Delete item.

With the delete item you can do combobox1.items.remove(combobox1.text).

Editing an item could be a two-step function where you "edit" the item in a
userbox, then delete the original and replace it with the edited version.

Lennart
"martin1" <ma*****@discussions.microsoft.comwrote in message
news:15**********************************@microsof t.com...
hi, Lennart,

Thanks. One more question - after add there, how to edit/remove item from
list?

Martin

"Lennart Nielsen" wrote:
I'm not sure how you initially fill the combobox, but the user can add
items
like the following and then tie in with list or database at the same
time.

Lennart

Private Sub ComboBox1_KeyDown(ByVal sender As Object, ByVal e As
System.Windows.Forms.KeyEventArgs) Handles ComboBox1.KeyDown
If e.KeyCode = Keys.Enter And ComboBox1.Text IsNot Nothing Then

ComboBox1.Items.Add(ComboBox1.Text)

ComboBox1.Text = Nothing

End If

End Sub

"martin1" <ma*****@discussions.microsoft.comwrote in message
news:4F**********************************@microsof t.com...
Hi, All,

when starting run app, how to let user add item/edit item to comboBox
on
the
Form,

Thanks,
Martin


Nov 16 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Phil | last post by:
My form uses a dataset containing two tables, a base table (Contact) and a lookup table (Insurer). My combobox is bound as follows: DataSource = datasetContact DisplayMember =...
2
by: Nate | last post by:
I have used the feedback on this issue to remedy my comboboxes showing the first item on the list when a new record is added to the binding context --- Me.BindingContext(dsOrders,...
4
by: Drum2001 | last post by:
I have a combobox that is populated from a button on the form. One pushes this button and the following happens: !! = Me.ItemName So the combobox no shows whatever was in Me.ItemName. Here...
2
by: Brett Romero | last post by:
After I remove all items from a combobox, the last selected item remains in the display area. I've tried: mycbox.SelectedText = string.Empty; and mycbox.refresh(); How do I clear the...
9
by: Franky | last post by:
I have a usercontrol that inherits from ComboBox I'd like to add the feature that the user can delete any item Best would be that he could right click an element and a messagebox would ask if...
4
by: Jerad Rose | last post by:
I'm baffled by this -- is there not a typed object used for ComboBox Items? Best I can tell, all of the methods for ComboBox that accept an Item are of type Object. Why in the world is a...
7
by: Brad Pears | last post by:
I have something strange going on - pretty sure it used to work before - and now it does not... Why does the following code not clear a combo box? Me.cboLocation.Text = String.Empty OR ...
0
by: sony.m.2007 | last post by:
Hi, I'm creating a combox control in XAML(WPF) and loading the items from a table in sql server. There are four items in the combobox.I need to hide an item in the combobox and to show three...
2
by: kurtzky | last post by:
i created a form that should function as follows: i will enter a number in a textbox..then it should query from the database all the records which has that number..these records will have a...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.