Solved

The data to checked listbox is not correct

Posted on 2007-11-14
14
209 Views
Last Modified: 2010-04-23
       CheckedListBox1.DataSource = Me.BindingSource1

        CheckedListBox1.DisplayMember = Me.DataSet1.ITEM.ITM_TYPEColumn.ToString()


When starting the program all i get from the checked listbox is system.data.DataViewManagerListItemTypeDescriptor

Im connecting to a oracle database, and i dont understand why i dont get the Item types in the checked listbox when i start program :/

Please help
0
Comment
Question by:leeds2000
  • 7
  • 5
14 Comments
 
LVL 8

Expert Comment

by:Chumad
ID: 20282720
You need to also define the fields where the data comes from...

CheckedListBox1.DataTextField = "someField";
CheckedListBox1.DataValueField = "someotherField";
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282738
uhm, im sorry, i dont quite understand that one, what should i use in the "someField" ?
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282749
also, datatextfield is not a member of the checklistbox1 i get a error saying in visual studio, so i cant use the datatextfield or the datavaluefield
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 8

Expert Comment

by:Chumad
ID: 20282765
Well, for DataTextField, that's what the user sees - the value in the list box. This needs to point to some field or property in DataSet1. Here, I'm going to assume you need to use "ITM_TYPEColumn"

CheckedListBox1.DataTextField = "ITM_TYPEColumn";

Likewise, DataValueField is going to point to the property/field in DataSet1 that contains the value - usually a primary key. You can probably use the same value here if you want "ITM_TYPEColumn"
0
 
LVL 8

Expert Comment

by:Chumad
ID: 20282772
Try using DisplayMember instead:

CheckedListBox1.DisplayMember = "ITM_TYPEColumn";
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282803
ok thanks, but i cant use checkedlistbox1.datatextfield, becouse of this error:

'datatextfield' is not a member of system.windows.forms.checkedlistbox

this error is the same for the checkedlistbox1.datavaluefield

0
 
LVL 8

Expert Comment

by:Chumad
ID: 20282824
ok, I wasn't aware you were doing windows forms (vs web forms). Try this way:

CheckedListBox1.DisplayMember = "ITM_TYPEColumn"
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20282861
oki, well i tried it and i got the same result, is this code supposed to be instead of the .displaymember i already have in my code, or should i add it under my code?

I tried removing my version of the display member, and adding your version, but i got same result. i tried with just yours but i still got same, anything im doing wrong?
0
 
LVL 8

Expert Comment

by:Chumad
ID: 20282891
Can you paste all your modified code in here (the version that has the suggested changes)?
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20283089
CheckedListBox1.DataSource = Me.BindingSource1

        CheckedListBox1.DisplayMember = Me.DataSet1.ITEM.ITM_TYPEColumn.ToString()

then i add your part of the code

CheckedListBox1.DisplayMember = "ITM_TYPEColumn"

ive also tried removing the CheckedListBox1.DisplayMember = Me.DataSet1.ITEM.ITM_TYPEColumn.ToString()

without any luck
0
 
LVL 3

Accepted Solution

by:
leeds2000 earned 0 total points
ID: 20337175
The error was that i hadnt added a tableadapter to my form :/
0
 
LVL 3

Author Comment

by:leeds2000
ID: 20365436
And my code worked as soon as i added this tableadapter, so always check if you have a tableadapter in visual studio 2005 if you cant get any data as soon as your form loads :)
0
 
LVL 1

Expert Comment

by:Vee_Mod
ID: 20391004
Closed, 500 points refunded.
Vee_Mod
Community Support Moderator
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
1.0 - Introduction Converting Visual Basic 6.0 (VB6) to Visual Basic 2008+ (VB.NET). If ever there was a subject full of murkiness and bad decisions, it is this one!   The first problem seems to be that people considering this task of converting…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

680 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question