Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

The data to checked listbox is not correct

Posted on 2007-11-14
14
Medium Priority
?
225 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
A while ago, I was working on a Windows Forms application and I needed a special label control with reflection (glass) effect to show some titles in a stylish way. I've always enjoyed working with graphics, but it's never too clever to re-invent …
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

715 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