473,765 Members | 2,066 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 2420
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_KeyDo wn(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles ComboBox1.KeyDo wn
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*****@discus sions.microsoft .comwrote in message
news:4F******** *************** ***********@mic rosoft.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_KeyDo wn(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles ComboBox1.KeyDo wn
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*****@discus sions.microsoft .comwrote in message
news:4F******** *************** ***********@mic rosoft.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
contextmenustri p with an Edit and a Delete item.

With the delete item you can do combobox1.items .remove(combobo x1.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*****@discus sions.microsoft .comwrote in message
news:15******** *************** ***********@mic rosoft.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_KeyDo wn(ByVal sender As Object, ByVal e As
System.Windows .Forms.KeyEvent Args) Handles ComboBox1.KeyDo wn
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*****@discus sions.microsoft .comwrote in message
news:4F******* *************** ************@mi crosoft.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
contextmenustri p with an Edit and a Delete item.

With the delete item you can do combobox1.items .remove(combobo x1.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*****@discus sions.microsoft .comwrote in message
news:15******** *************** ***********@mic rosoft.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_KeyDo wn(ByVal sender As Object, ByVal e As
System.Windows. Forms.KeyEventA rgs) Handles ComboBox1.KeyDo wn
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*****@discus sions.microsoft .comwrote in message
news:4F******** *************** ***********@mic rosoft.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
3452
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 = Insurer.InsurerName ValueMember = Insurer.InsurerId DataBindings.SelectedValue = Contact.InsurerId It generally works fine. I am able to navigate records and
2
2854
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, "tblOrders").AddNew() Me.ComboBox1.SelectedIndex = -1 but... how do we deal with the same issue during record navigation? When I move forward or backward onto a null field the combo defaults to the first item on the list again?
4
13468
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 is my question... How do I autoselect this item? I know the following code will select
2
5216
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 display area of a combobox after removing all of its
9
2458
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 he wanted to delete that element I can't find an event that would enable me to do that. I could copy the items into a text box, let him edit it and put them back
4
6666
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 common/standard .NET control accepting an Object as a parameter type? In Web Forms, there is a ListItem object that can be passed in to add/retrieve objects from a DropDownItems collection. I searched Google groups, and all the solutions I'm finding...
7
3582
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 Me.cboLocation.Text = ""
0
3144
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 items to the user.I don't want to remove and add items after binding the data from table I tried to find any properties{in items) to make an item invisible in combobox, but didn't find any properties to make an item invisible.Is there any...
2
3684
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 different item no in it..then, these records will be saved in a temporary datatable (which i made in a separate class, the name is WBASKET)...The item nos of these records will be displayed in a combobox, say item1, item2, etc.. then,i have a datagrid...
0
10164
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10007
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9959
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8833
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6649
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5277
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5423
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3926
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3532
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.