Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleteing some rows from the datagrid

Status
Not open for further replies.

njahnavi

Technical User
Dec 29, 2008
136
US
HI I am using vb.net version 2.0
As I said in earlier posts i am newbie to vb.net

I have a datagrid where I display some rows based on a date combo box.
If the user changes the date then that particular rows will be selected.
The issue is the datagrid has also facility to delete the data once the user clicks the delete button then I have to delete all the rows from the binding source which has the date value as the combo box date.

Please let me know how to do it...
 
I'm not sure I understand, but if you're trying to change the data in the DataGridView based on the date the user selects, then what you can do is create a DataView. A DataView is an object which is a filtered view of a DataTable. So, you can create a DataView, bind your DataGridView to the DataView, and then change the filter on the DataView when the value in the ComboBox changes. The rows displaying in the DataGridView will automatically change.
 
Thanks for the reply.
evenif i do that i have to update the bindingsource to update the table related to it...

so please tell me how to loop through the binding source and remove some rows from it...
 
actually i have to loop through the biniding source for two scenarios...

once when user wants to remove the data for a particular date then i want to loop thruogh the binding source and remove the data from it so that it can reflect the datagrid and also the table adapter when I use update.

Second is if a user has selected a date and there are not enough rows in it say he is short of some rows then I am adding that dummy rows to the Binding source so that user can see them however these dummy rows should be deleted from the Binding source so that we can update only with the real rows to the table adapter...

pelase help me how to acheive these taskss...

All i need is how to loop through the binidsource and deelte some rows...hope i made myself clear..please ask me if you need any clarifications....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top