Windows Develop Bookmark and Share   
 index > Windows Forms Data Controls and Databinding > Data display in rows, run time filter based on column value
 

Data display in rows, run time filter based on column value

Hi Friends,

I am learning .net these days on my own. I have created a small application that gets data from access file. There are multiple rows. in each row i have 8 columns.

first column (Product Name) gets data from table1-column1.
Second column cell (Dia) gets filtered data based on value incolumn 1.
Third column cell gete data based on first and second column.
Fourth column based on 1, 2nd, 3rd. (4th column is no of pieces/kg)
we put raw material value in 5th column.
in 6th Column, we get price per piece
in 7th column, we put selling price.
8th column tells us how much we are making or loosing /kg.


Pretty simple application.

However, i know following limitations of my code

1. its not too optmized. For each drop down, data get retrieved from DB.
2. No of rows are hard coded.
3. Form apearance is not too good.


Can we do it using datagrid or some other means?


Code can be downloaded from following location


Download here


Regards
Ajay

ajayZombie  Thursday, October 01, 2009 11:25 AM

Hi,

 

You can use DataGridView to implement this.

For the filter datasource, you can use comboboxColumn.

There is an FAQ tell about set one column datasource base on other column. When the second cell begin edit, filter datasource, remove the filter when cell end edit.

27. How do I have a combo box column display a sub set of data based upon the value of a different combo box column?

http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/a44622c0-74e1-463b-97b9-27b87513747e#faq27

 

If you use bind datagridview to a datatable, you can also set DataColumn.Expression property of columns.

 DataColumn.Expression Property

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

Best regards,

Ling Wang


Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Wednesday, October 07, 2009 9:00 AM

Hi,

 

You can use DataGridView to implement this.

For the filter datasource, you can use comboboxColumn.

There is an FAQ tell about set one column datasource base on other column. When the second cell begin edit, filter datasource, remove the filter when cell end edit.

27. How do I have a combo box column display a sub set of data based upon the value of a different combo box column?

http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/a44622c0-74e1-463b-97b9-27b87513747e#faq27

 

If you use bind datagridview to a datatable, you can also set DataColumn.Expression property of columns.

 DataColumn.Expression Property

http://msdn.microsoft.com/en-us/library/system.data.datacolumn.expression.aspx

Best regards,

Ling Wang


Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Ling Wang  Wednesday, October 07, 2009 9:00 AM

You can use google to search for other answers

Custom Search

More Threads

• Memo Field being cut off
• Dynamic Fields in Crystal Report
• Filtering a dataset and adding a new item
• datasource/dataadapter question
• Problem with databinding?
• Insert dataset or datagrid view into an Access Table
• Suggestions on how to deal with Inserting/Updating a Master-Detail record
• how do I bind a dataset to a combobox?
• Adding progressbar to Datagridview
• problem with data binding