|
-
Jan 23rd, 2008, 03:56 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] [2005] Adding Values to Combobox and Resizing Columns in ListView
Hello everyone. I have a small problem I am trying to get around.
I have a program that reads data from text files (working on talking the dept to let me use a database for the text files, but not there yet) and puts the data into listviews.
The Listviews have mutlipel columns and I have comboboxes for each column in each ListView.
The reason for the comboboxes is so the users can filter the data being shown in the listviews.
I was getting duplicate values in the comboboxes list because some of the data in the listviews has the same values in certain columns.
So i added a procedure that checks to see if a value is already in the combobox list and adds it if it isn't.
This has added a large amount of time to the load time of the form. Is there another way of doing this i am missing?
Another thing that is adding even more time is I have a procedure that resizes the columns in the listview and the resizes the comboxes so that it kinds of aligns the comboboxes with the columns. So the correct combobox is above the correct column.
Thanks in advance for your help and/or ideas!
-
Jan 23rd, 2008, 09:13 PM
#2
Re: [2005] Adding Values to Combobox and Resizing Columns in ListView
Don't use a ListView. Use a DataGridView. Bind it to a BindingSource which has in-built support for filtering and sorting.
-
Jan 24th, 2008, 08:18 AM
#3
Thread Starter
Hyperactive Member
Re: [2005] Adding Values to Combobox and Resizing Columns in ListView
I thought you could only use a datagrid view when you were connecting to a database?
Whats an example of a bindingsource that has built in support for filtering?
Thank you!
-
Jan 24th, 2008, 05:25 PM
#4
Re: [2005] Adding Values to Combobox and Resizing Columns in ListView
You thought wrong. A DataGridView can display pretty much any data you want. It is most commonly used to display data that has come from a database, but that's just the nature of applications. The grid cares nothing for where the data has come from.
There's no "example" of a BindingSource that has built-in support for filtering. BindingSource is a class and that class does have built-in support for filtering. That said, the BindingSource itself has to be bound to a list that supports filtering. If your data is in a DataTable then that support exists, so you can bind a DataTable to a BindingSource to a DataGridView and you have filtering support. Otherwise you would have to define your own class that implements the IBindingListView interface and implement your own filtering functionality. That is not a difficult task.
-
Jan 25th, 2008, 09:26 AM
#5
Thread Starter
Hyperactive Member
Re: [2005] Adding Values to Combobox and Resizing Columns in ListView
thank you! I started playing around with it last night, the datagridview, and i like it. I will start working with the bindingsource hopefullyl ater today to see what i can do with that.
Thanks!
-
Jan 25th, 2008, 08:18 PM
#6
Re: [2005] Adding Values to Combobox and Resizing Columns in ListView
Make sure you don't just play. Make sure you read too. The MSDN Library provides plenty of documentation for the DataGridView and BindingSource classes, as it does for all classes in the Framework. The DataGridView gets special attention though.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|