Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27046

VS 2012 Filtered Binding Source. How to Update/Delete my DataTable?

$
0
0
Hi guys. This is my first post here. Please guide me in posting here. :wave:


I have a Datatable that is filled in from user inputs which i got from different forms.

Code:

Dim temptable as Datatable
Then i converted my Datatable to a binding source and applied a filter

Code:

Dim bs as new BindingSource
        bs.DataSource = temptable
        bs.Filter = "WorkName LIKE '%" & txtWorkName.Text & "%' "

Then I Set my Datagridview1.Datasource to my Binding Source.
Code:

DataGridView1.DataSource = bs
My question is:

I need to update/delete data from my Datatable
Code:

Temtable
but i dont know how to access it because i cant use
Code:

Rowindex
because my data in my datagrid is filtered by my binding source.

Here Sample data/columns in my table
Sorry i dont know how to use tables here :(
Code:

TempTable
Name Id auto increment) Color Address
John 1 Red USA
Mark 2 Green USA
Peter 3 Blue Australia
Mary 4 Yellow Australia
Jack 5 Orange Australia


Now here is my datagrid filtered by address('usa')
Code:

bs.Filter("Address LIKE" "& USA &"")
Code:

Datagridview1.Datasource = bs
Name Id auto increment) Color Address
John 1 Red USA DELETEbutton
Mark 2 Green USA DELETEbutton



Now here is my datagrid filtered by address('australia')
Code:

bs.Filter("Address LIKE" "& australia &"")
Code:

Datagridview1.Datasource = bs
Name Id auto increment) Color Address
Peter 3 Blue Australia DELETEbutton
Mary 4 Yellow Australia DELETEbutton
Jack 5 Orange Australia DELETEbutton

How Can i Delete the actual data right straight to my Datatable if im showing it using Bindsource in my Datagrid?

Thank you More Power!

Viewing all articles
Browse latest Browse all 27046

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>