Re: Fill Combo :: "System.data.dataRowView"

P

Peter Foot [MVP]

This is a symptom of the FieldName supplied in

Me.cboProductName.DisplayMember = "ProductName"

being incorrect. If this does not exactly match to a valid fieldname (Case
Sensitive) exposed by the collection you will get:-

"System.Data.DataRowView"



Peter

--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
Handheld Interactive Reference Guides
 
W

WSM

Hi,

Thanks for your Help. It Worked.

But one thing is very strange for me; "How could something be case sensitive
in a non-case-sensitive language like VB .NET?"

Anyways, Thanks again for your help.

WSM
 
P

Peter Foot [MVP]

Does it work if you cast the selected item to a string:-
Me.cboProductName.SelectedItem().ToString()

Although the item is displayed as a string it is actually a generic
"Object".



Peter
--
Peter Foot
Windows Embedded MVP

In The Hand
http://www.inthehand.com
Handheld Interactive Reference Guides
 
M

Mark Reddick

I ran into the exact same issue. I ended up wrapping a Try/Catch handler
around the code and explictly catch the cast error and ignore it. Something
like this:

try
{
int myId = (int)myCombo.SelectedValue;

// more code here
}
catch (InvalidCastException)
{
// do nothing
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top