473,563 Members | 2,856 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ComboBox Question

I provide a bunch of items at form load for the combo box.

What I want to do is if the user chooses to enter a value not in the item
list I want to be able to grab that and assign it to a string variable.

is this possible?

Nov 20 '05 #1
8 7035
Hello,

"scorpion53 061" <sc************ @yahoo.com> schrieb:
I provide a bunch of items at form load for the combo box.

What I want to do is if the user chooses to enter a value not
in the item list I want to be able to grab that and assign it
to a string variable.


You can use the combobox's 'FindString' and 'FindStringExac t' methods to
check if a string is contained in the item list.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #2
drnew.Item("TYP E") = ComboBox1.Text. ToString

This doesnt add what the user put in the combo box.

What do you think would?

"Herfried K. Wagner [MVP]" <hi*******@m.ac tivevb.de> wrote in message
news:O7******** ******@TK2MSFTN GP10.phx.gbl...
Hello,

"scorpion53 061" <sc************ @yahoo.com> schrieb:
I provide a bunch of items at form load for the combo box.

What I want to do is if the user chooses to enter a value not
in the item list I want to be able to grab that and assign it
to a string variable.


You can use the combobox's 'FindString' and 'FindStringExac t' methods to
check if a string is contained in the item list.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #3
Cor
Scorpion
I should try to put it in a messagebox first to test it
For me it works
drnew.Item("TYP E") = ComboBox1.Text. ToString

messagebox.show (combobox1.text .toString)

I hope this helps you a little bit.
Cor
Nov 20 '05 #4
Hello,

"scorpion53 061" <sc************ @yahoo.com> schrieb:
drnew.Item("TYP E") = ComboBox1.Text. ToString
You don't need to call 'ToString' here, 'Text' will return a string.
This doesnt add what the user put in the combo box.


What is 'drnew'? Are you working with a databound combobox?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #5
Nak
> drnew.Item("TYP E") = ComboBox1.Text. ToString

This doesnt add what the user put in the combo box.


Are you wanting to add to the same combo box that the user has selected
from? To add items to a combo box you need to use the add method of the
items collection...

combobox1.Items .Add("my string")

But when do you want to add to the combo box? After the user has finished
typing? Remember there is no way to know if the user has *finished* typing
as such unless you actually use a timer, which is a bit of a fudge. Maybe
check for the enter key being pressed in the keydown event?

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) Then
If (ComboBox1.Find StringExact(Com boBox1.Text) = -1) Then
Call ComboBox1.Items .Add(ComboBox1. Text)
End If
End If
End Sub

But then again I might have the wrong idea about what you want?

Nick.

--
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
"No matter. Whatever the outcome, you are changed."

Fergus - September 5th 2003
/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\
Nov 20 '05 #6
Hi Herfried,

drnew = drNew = datarowNew ;-)

Regards,
Fergus
Nov 20 '05 #7
Correct herfried......
I am trying to add the combobox control's text as a entry in a dataset even
if the user had changed it.

"Herfried K. Wagner [MVP]" <hi*******@m.ac tivevb.de> wrote in message
news:ep******** *****@tk2msftng p13.phx.gbl...
Hello,

"scorpion53 061" <sc************ @yahoo.com> schrieb:
drnew.Item("TYP E") = ComboBox1.Text. ToString


You don't need to call 'ToString' here, 'Text' will return a string.
This doesnt add what the user put in the combo box.


What is 'drnew'? Are you working with a databound combobox?

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet

Nov 20 '05 #8
Hello,

"Fergus Cooney" <fi******@tesco .net> schrieb:
drnew = drNew = datarowNew ;-)


That's what I thought, but I was not sure.

--
Herfried K. Wagner
MVP · VB Classic, VB.NET
http://www.mvps.org/dotnet
Nov 20 '05 #9

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

Similar topics

10
1937
by: Mr. B | last post by:
I've been seeking the solution to this. But can't figure it out (sounds simple enough). When you Populat a ComboBox, you can select the initial displayed items on startup simply by setting the TEXT to a valide item in the Combobox. What I want to do is to select the initial listed item to an item based upon a varrying veriable. For...
6
2328
by: Georges Heinesch | last post by:
An easy ComboBox question. ;) I would like to create a ComboBox, which permits to cycle through 3 subforms. These 3 subforms are entered in the ComboBox as Value List. The subforms should only be selectable via the cycle gadget (the button with the arrow right of every ComboBox control) of the ComboBox. How can disable the left part (text...
7
8495
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 of doing it. I have a table with products, tblProducts, some of them are Active while others are Inactive. The form shows all the products...
4
1744
by: David Sworder | last post by:
Hi, I have a ComboBox that contains 1,400 sorted items . Here's the list: abba apple ... cabba caccaa capple
4
9090
by: Beeeeeeeeeeeeves | last post by:
I have an ownerdrawn combo box which I am drawing with an image and some text, this is all working beautifully apart from the difference in the Brush I have to draw the background and the text with if the item is the currently selected one. I have selected a blue (SystemColors.Highlight) background brush and white (SystemColors.HighlightText)...
0
2655
by: Hiroyuki Tanaka | last post by:
Hi All, I am trying to develop an application for a touch screen using buttons for the numeric pad with Completion ComboBoxes. At the moment I am having a problem sending the button presses to my Completion ComboBox using sendkey.wait. From the keyboard (that will not exist for my final application) I can enter text into my Completion...
2
4325
by: pei_world | last post by:
I want to implement a key hit with enter to dropdown a combobox that is in the datagrid. in this case I need to override its original behaviours. I found some codes from the web. Does anyone know how to use this code? please help! http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_20862953.html
6
7796
by: Sakharam Phapale | last post by:
Hi All, How to fill one ComboBox from other ComboBox control? 1) Only setting the reference does the trick but doesn't show items in control. If you see in immediate window, it shows the item count correctly
6
10576
by: Hal Heinrich | last post by:
How do I implement the value equivalent of the ComboBox.FindStringExact method? I.e. How do I set the ComboBox.SelectedIndex so that the ComboBox.SelectedValue object matches one that I specify. Thanks in advance for any help, Hal Heinrich VP Technology Aralan Solutions Inc.
4
1810
by: JJGarcia | last post by:
Hi Everyone, I'll try to explain the process I'm following, I'm new to this so I'm triying the easy way first, probably the lasyest too! I created a new Project, drag in to it a SQLConnection, configured, dragged an Dataadapter per each table I need it, then generated the dataset, after that, I stablished the relations between tables,...
0
7665
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7888
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. ...
0
8106
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...
1
7642
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...
0
7950
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5484
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3643
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...
1
1200
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
924
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.