16,006,065 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View .NET questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by luccingolo (Top 2 by date)
luccingolo
7-Apr-11 18:21pm
View
Hi Mika, thank you for joining the discussion. But I'm not trying to combine two separate datatables. I am only trying to display the data of a related childdatatable in a ListBoxelement. I would like to display the listboxitem's number in front of the item itself. So, for example, if there are five items in the listbox, then they should be numbered from one to five. If the same listbox contains ten items, then these items should be numbered from one to ten...and so on. I use a datatemplate with two textboxes to diplay the data in the listbox. The first textbox for the number of the item, and the second textbox for the item itself.
The first problem is to find out how many items the listbox will be composed of every time the current related datarow of the parenttable changes. And then the first textbox of the listbox's datatemplate will have to be bound to the items number.(from 1 to listbox.items.count)
In my project I dont get the data right from the datatables but I "load" it in a data-entity model. And this entity-model is the "source" for my ViewModel-Class where a public ChildView-property(and a public parentView-property as well)of ICollectionView-Type keeps the updated childdatarows. At this time I have bound the textbox of the listbox's datatemplate to this public childview of my viewmodel-class. And now I hope that somebody can show me how to bind the other textbox of this datatemplate, to get a number for every listbox-item.
So I hope that now it's a little bit easier for you to understand what I'm trying to do here.
Thanks,
luccingolo
luccingolo
10-Nov-10 13:31pm
View
Hi Henry Minute.
So I hope you will get an email this time. Thanks to you I have at least learnd how to post an answer....
The way the guys from MSDN solved the iteration problem is not realy what I was loking for.
In the MSDN-example they get an integer value from the Datatable.
Dim colCount As Integer = view.Table.Columns.Count
But in my projekt the data I'm working with is held in a BindingSource.
The way i finally settled it is the ItemArray property of the Datarow object.
Dim myDR As DataRow = CType(Me.myBS.Current, DataRowView).Row
For Each fieldContent In myDR.ItemArray
Console.WriteLine("Item: {0}", fieldContent.ToString)
Next
But I thank you for your help. Your answers gave me the "keywords" to google for.
And last but not least.... You told me to add a comment to your answer. Thats what I'm doing right here.
But this "Submit comment-Textbox" offers no "text or code enhancement facilities". Shoudn't I use this "Add your answer here"-box below to type my comment????
Thanks