Solved

The data to checked listbox is not correct

Posted on 2007-11-14
14
221 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

632 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