473,467 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

combobox

how can i make a combobox that can store or add additional fields?

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200803/1

Mar 6 '08 #1
6 1541
"enrico via DotNetMonster.com" <u41845@uwewrote in message
news:80ba5ee4c99f8@uwe...
how can i make a combobox that can store or add additional fields?
ComboBox1.Items.Add("blah")
ComboBox1.Items.Add("1234")
Mar 6 '08 #2
"Trammel" <Me@Server.comwrote in message
news:vc*********************@fe3.news.blueyonder.c o.uk...
"enrico via DotNetMonster.com" <u41845@uwewrote in message
news:80ba5ee4c99f8@uwe...
>how can i make a combobox that can store or add additional fields?

ComboBox1.Items.Add("blah")
ComboBox1.Items.Add("1234")
This can be expanded-on using a button labeled "+" or however you submit
changes to the form/box:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim iLoop As Long
Dim bFound As Boolean = False
For iLoop = 0 To ComboBox1.Items.Count - 1
If UCase(ComboBox1.Text) = UCase(ComboBox1.Items.Item(iLoop)) Then
bFound = True
Next
If bFound = False Then ComboBox1.Items.Add(ComboBox1.Text)
End Sub
Mar 6 '08 #3
"Trammel" <Me@Server.comwrote in message
news:nm*********************@fe3.news.blueyonder.c o.uk...
"Trammel" <Me@Server.comwrote in message
news:vc*********************@fe3.news.blueyonder.c o.uk...
>"enrico via DotNetMonster.com" <u41845@uwewrote in message
news:80ba5ee4c99f8@uwe...
>>how can i make a combobox that can store or add additional fields?

ComboBox1.Items.Add("blah")
ComboBox1.Items.Add("1234")

This can be expanded-on using a button labeled "+" or however you submit
changes to the form/box:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Dim iLoop As Long
Dim bFound As Boolean = False
For iLoop = 0 To ComboBox1.Items.Count - 1
If UCase(ComboBox1.Text) = UCase(ComboBox1.Items.Item(iLoop)) Then
bFound = True
Next
If bFound = False Then ComboBox1.Items.Add(ComboBox1.Text)
End Sub
Also, if you not bothered about people adding multiple words in different
cases (Aka: Blah, blah, bLaH, etc) then it can be shortened to one line,
like:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Not ComboBox1.Items.Contains(ComboBox1.Text) Then
ComboBox1.Items.Add(ComboBox1.Text)
End Sub
Mar 6 '08 #4
i'm sorry, i can barely grasp what you meant about the .tostring() part. i'm
not yet familiar on this language. can you elaborate more... tnx...

--
Message posted via http://www.dotnetmonster.com

Mar 6 '08 #5
thanks for the help trammel. i plainly use the code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If Not ComboBox1.Items.Contains(ComboBox1.Text) Then
ComboBox1.Items.Add(ComboBox1.Text)
End Sub

and it worked.. but is there a way that those new fields that were entered in
the combobox will be part of the combobox's list? for example: the fields in
the combobox are B, C, D then i entered A. every time i close my form and
then reopen there are still 3 fields in the combobox. i want A be be part of
that list, is it possible?

--
Message posted via http://www.dotnetmonster.com

Mar 7 '08 #6
Enriico,

That depends completely from how you this combined box use.

That combobox means in a way the same a multi tool.

:-)

Cor

"enrico via DotNetMonster.com" <u41845@uweschreef in bericht
news:80ba5ee4c99f8@uwe...
how can i make a combobox that can store or add additional fields?

--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...b-net/200803/1
Mar 7 '08 #7

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

Similar topics

13
by: Mr. B | last post by:
Here's the situation... You've a combobox with Items already added. Say they look like this (or even lines of text): 10-00-232 10-00-256 10-01-006 10-01-213 10-02-200
7
by: Nicolae Fieraru | last post by:
Hi All, I am trying to change the rowsource of a combobox when I click on it. I played with many events, associated with the form and the combobox, but still haven't figured out what is the way...
8
by: Zlatko Matię | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the...
1
by: anonymous | last post by:
I've been trying to put a them, please help me out. Here's the major parts of my code: public Form1() { DataSet myDataSet = new DataSet("myDataSet"); DataTable testTable = new...
3
by: TT (Tom Tempelaere) | last post by:
Hay there, I'm writing my own DataGridComboBoxColumn because .NET 1.1 does not have one (I hope .NET 2.0 supplies one). I based it on this article:...
2
by: Don | last post by:
I've looked high and low for some code that will allow me to have a combobox with a flat borderstyle. I found a few examples, but nothing that was really usable for me. I had the following...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
6
by: dbuchanan | last post by:
VS2005 I've been reading all the help I can on the topic (MSDN, other) but I can't make sense of this. Desired behavior; The user is to choose from the displayed list of the databound combobox...
1
by: polocar | last post by:
Ciao a tutti, leggendo qua e lą per il forum ho scoperto che non sono l'unico ad avere questo problema. Se si inserisce un controllo ComboBox in un form di C#, non č possibile impostare la sua...
5
by: Rich | last post by:
Hello, I have a search application to search data in tables in a database (3 sql server tables). I populate 2 comboboxes with with data from each table. One combobox will contain unique...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.