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 2932
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: 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: 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...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
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...
| |