Hi
I'm using this code to display the selected item in msgbox
Dim ob As Object
ob = cmbCategory.SelectedItem
MsgBox(ob.ToString())
but all what I see is "System.Data.DataRowView", and the same result with
cmbCategory.Text .
thanks
--
Regads,
Rochdi 6 2930
Oh, I forget the mention that the code is the
ComboBox1_SelectedIndexChanged event
--
Regads,
Rochdi
"Mike" wrote: Hi I'm using this code to display the selected item in msgbox Dim ob As Object ob = cmbCategory.SelectedItem MsgBox(ob.ToString()) but all what I see is "System.Data.DataRowView", and the same result with cmbCategory.Text .
thanks
-- Regads, Rochdi
Try
MsgBox (ComboBox1.Items(ComboBox1.SelectedIndex).ToString )
HTH, Phil
"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:4D**********************************@microsof t.com... Hi I'm using this code to display the selected item in msgbox Dim ob As Object ob = cmbCategory.SelectedItem MsgBox(ob.ToString()) but all what I see is "System.Data.DataRowView", and the same result with cmbCategory.Text .
thanks
-- Regads, Rochdi
Your objects in the combo box are of type "System.Data.DataRowView" whose
"ToString" method returns the object's type name. Also, the text placed
into the combo items will be whatever the object's "ToString" method returns
unless you are using binding. I believe that if you are binding the combo
box to a DataView object, you need to set the ValueMember and DisplayMember
properties of the combo box.
Dennis in Houston
"Mike" wrote: Oh, I forget the mention that the code is the ComboBox1_SelectedIndexChanged event -- Regads, Rochdi
"Mike" wrote:
Hi I'm using this code to display the selected item in msgbox Dim ob As Object ob = cmbCategory.SelectedItem MsgBox(ob.ToString()) but all what I see is "System.Data.DataRowView", and the same result with cmbCategory.Text .
thanks
-- Regads, Rochdi
Yes I'm binding it to a dataset like this:
cmbCategory.DataSource = Qds.Tables(0)
cmbCategory.DisplayMember = "Category"
where Category is the column that exist in the Qds.Table(0).
but how can I set the ValueMember!!!?
--
Regads,
Rochdi
"Dennis" wrote: Your objects in the combo box are of type "System.Data.DataRowView" whose "ToString" method returns the object's type name. Also, the text placed into the combo items will be whatever the object's "ToString" method returns unless you are using binding. I believe that if you are binding the combo box to a DataView object, you need to set the ValueMember and DisplayMember properties of the combo box.
Dennis in Houston
"Mike" wrote:
Oh, I forget the mention that the code is the ComboBox1_SelectedIndexChanged event -- Regads, Rochdi
"Mike" wrote:
Hi I'm using this code to display the selected item in msgbox Dim ob As Object ob = cmbCategory.SelectedItem MsgBox(ob.ToString()) but all what I see is "System.Data.DataRowView", and the same result with cmbCategory.Text .
thanks
-- Regads, Rochdi
No, it's not working
--
Regads,
Rochdi
"Phil G." wrote: Try
MsgBox (ComboBox1.Items(ComboBox1.SelectedIndex).ToString )
HTH, Phil
"Mike" <Mi**@discussions.microsoft.com> wrote in message news:4D**********************************@microsof t.com... Hi I'm using this code to display the selected item in msgbox Dim ob As Object ob = cmbCategory.SelectedItem MsgBox(ob.ToString()) but all what I see is "System.Data.DataRowView", and the same result with cmbCategory.Text .
thanks
-- Regads, Rochdi
Oh, don't worry I have set the Valuemember and its working Thanks
--
Regads,
Rochdi
"Dennis" wrote: Your objects in the combo box are of type "System.Data.DataRowView" whose "ToString" method returns the object's type name. Also, the text placed into the combo items will be whatever the object's "ToString" method returns unless you are using binding. I believe that if you are binding the combo box to a DataView object, you need to set the ValueMember and DisplayMember properties of the combo box.
Dennis in Houston
"Mike" wrote:
Oh, I forget the mention that the code is the ComboBox1_SelectedIndexChanged event -- Regads, Rochdi
"Mike" wrote:
Hi I'm using this code to display the selected item in msgbox Dim ob As Object ob = cmbCategory.SelectedItem MsgBox(ob.ToString()) but all what I see is "System.Data.DataRowView", and the same result with cmbCategory.Text .
thanks
-- Regads, Rochdi This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
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
|
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...
|
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...
|
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...
|
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:...
|
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...
|
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...
|
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...
|
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...
|
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...
|
by: DolphinDB |
last post by:
Tired of spending countless mintues downsampling your data? Look no further!
In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: PapaRatzi |
last post by:
Hello,
I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
|
by: CloudSolutions |
last post by:
Introduction:
For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
| |