I want to get the text from a bound combobox in a variable
I try to use strVar = me.cboName.Sele ctedText.Tostri ng, but it doesn't work.
reidarT 4 1621
I found the answer myself. Just use me.cboName.Text
reidarT
"reidarT" <re****@eivon.n o> skrev i melding
news:ew******** ********@TK2MSF TNGP04.phx.gbl. .. I want to get the text from a bound combobox in a variable I try to use strVar = me.cboName.Sele ctedText.Tostri ng, but it doesn't work.
reidarT
The behavior for SelectedText will vary depending on how you are populating
the box. You say the method doesn't work. What is it returning?
Be aware that if no value is selected in the combo box, SelectedText (as
well as SelectedValue) will be Nothing. Calling .ToString on Nothing may
result in an exception. Also, If you set the ValueMember of the ComboBox,
you can check the SelectedValue with the same potential for null exception
handling. Additionally, if you are binding an object with a property of type
string to SelectedText or SelectedValue, make sure to check for Nothing before
doing any processing on the value.
Jim Wooley http://devauthority.com/blogs/jwooley/default.aspx I want to get the text from a bound combobox in a variable I try to use strVar = me.cboName.Sele ctedText.Tostri ng, but it doesn't work.
reidarT
Reidar,
Why not simple?
str = cboName.text
(your code is more listbox style with a combobox is the selectedtext in the
textbox)
Cor
"reidarT" <re****@eivon.n o> schreef in bericht
news:ew******** ********@TK2MSF TNGP04.phx.gbl. .. I want to get the text from a bound combobox in a variable I try to use strVar = me.cboName.Sele ctedText.Tostri ng, but it doesn't work.
reidarT
Sorry,
I had not seen your reply before sending my message
Cor
"reidarT" <re****@eivon.n o> schreef in bericht
news:O6******** ********@TK2MSF TNGP04.phx.gbl. .. I found the answer myself. Just use me.cboName.Text reidarT "reidarT" <re****@eivon.n o> skrev i melding news:ew******** ********@TK2MSF TNGP04.phx.gbl. ..I want to get the text from a bound combobox in a variable I try to use strVar = me.cboName.Sele ctedText.Tostri ng, but it doesn't work.
reidarT
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: MLH |
last post by:
I have a form with two controls:
!! - combo box
!! - text box
A button on the form tries to run this SQL when clicked...
INSERT INTO BodyMsgsSent (ToWhom, BodyText)
SELECT DISTINCTROW !! AS MyTargets,
!! AS MyList;
When the SQL runs, it fails with msg saying "Field length is too
|
by: ShyGuy |
last post by:
Is it possible to use code to enter some text into a combo box and
then have the cursor placed at the end of the text for more imput?
|
by: Thelma Lubkin |
last post by:
Arno R <arraNOcomSPAM@tiscali.nl> wrote:
:> user types Mary Jane Jones
:> database has MaryJane Jones
: I finally understand why you need to 'despace' the field in the
: Lookuptable also.
: First idea that comes to my mind now is that I would create the
: 'despaced' values in the LookupQuery:
: Database has:
: MaryJane Jones
|
by: ASP Yaboh |
last post by:
I have a WinForm ComboBox that is populated by binding to a dataset that
contains a list of employees (two columns: 1. employee id, 2. employee name).
The id is bound to the ValueMember, the name to the DisplayMember. The
dataset is then disposed.
When an item is selected from the combobox, the value is easy to get. Yet
when I try to capture the selected text I get a "DataRowView" back. I've
tried to work my way through the DataRowView...
|
by: Richard Bond |
last post by:
Hi,
I have a combobox that is bound to a list of text and values in a dataset.
It is in Dropdown mode - which enables the user to type in their own text if
they so wish. when I process the form, I check the Selected value property,
if it is 0 (not one of my bound values) then I know to add their new item to
my database using the combobox.Text property (after prompting them with a
few questions) .
I want to programatically set the text...
| |
by: Joe Schmoe |
last post by:
All I want to to be able to take a two-column DataReader (One column with
the Item ID number, the other with Item Description text) and load it into a
Windows Forms ComboBox (Set to DropDownList mode) so that I the dropdown
shows the Item Descriptions, but returns the Item ID number when selected.
Completely easy in ASP.NET, but I cannot figure out how to do the same in a
Windows Forms app. Obviously the Windows Forms ComboBox is a lot more...
|
by: lorirobn |
last post by:
Hi,
I have a form with several combo boxes, continuous form format, with
record source a query off an Item Table. The fields are Category,
Subcategory, and Color. I am displaying descriptions, not ID's, so I
have to convert the ID's from various lookup tables.
The combo boxes work fine except for subcategory, which is dependent on
category. Depending on category, the drop-down box for subcategory
will display different items. (for...
|
by: PW |
last post by:
Hi,
I have a form with unbound fields on it. The user selects a record
from a recordset and I populate the unbound fields. When I try to
change the unbound quantity text box, Access 2003 tells me "The data
has been changed. Another user edited this record and saved the
changes before you attempted to save your changes. Re-edit the
record."
This does not always happen. And yes, I can re-edit the quantity text
|
by: njb35 |
last post by:
Hi all
I'm beginning my foray from VBA into VB 2005 Express, and enjoying
some of the efficiencies it provides! I'm stuck with some dataset
handling however that I _think_ can be automated but I can probably
code what I want to do the hard way. I've searching around online but
can't find an answer to this specific question.
Here's the situation: I have a dataset table with 3 fields: one
indexed as a primary key and the other two...
|
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
| |
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
|
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();...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |