Good Day! Please help me on this :).
Im creating Windows Form Application. I collecting user inputs from different forms and save it to a DataTable.
Then i bind the Datatable to a BindingSource add do some Filtering:
Then i use the bindingsource as my datasource for my Datagridview:
Now i need to update and delete a row on my datatable which is filtered in my Datagridview.
I also added buttons in the Datagrid for deleting and updating.
For Deleting a Row, i used:
When Delete Button is Pressed.
Now, is there a way to make my EDIT button work? I want the selected row to be in textboxes of another form.
And Save the Changes to my Datatable
Please Guide Me. Thanks and God Bless.
Im creating Windows Form Application. I collecting user inputs from different forms and save it to a DataTable.
Code:
Dim temptable as new Datatable
temptable.Columns.Add("Name")
temptable.Columns.Add("ID")
temptable.Columns.Add("Department")
Code:
temptable.Rows.add("Jack",1,"Sales")
temptable.Rows.add("John",2,"Sales")
temptable.Rows.add("Mary",3,"IT")
temptable.Rows.add("Joseph",4,"IT")
Code:
Dim bs as New BindingSource
bs.Datasource = temptablebs.Filter = "Department LIKE '%" & Sales & "%' "
Then i use the bindingsource as my datasource for my Datagridview:
Code:
DataGridView1.DataSource = bs
I also added buttons in the Datagrid for deleting and updating.
Code:
Dim colConf As New DataGridViewButtonColumn
colConf.HeaderText = "Account"
colConf.Text = "Edit"
colConf.Name = "colconf"
colConf.UseColumnTextForButtonValue = True
Me.DataGridView1.Columns.Add(colConf)
Code:
'Datagridview Delete BUTTON
Dim colConf2 As New DataGridViewButtonColumn
colConf2.HeaderText = "Account"
colConf2.Text = "Delete"
colConf2.Name = "colconf"
colConf2.UseColumnTextForButtonValue = True
Me.DataGridView1.Columns.Add(colConf2)
Code:
bs.RemoveCurrent
Now, is there a way to make my EDIT button work? I want the selected row to be in textboxes of another form.
And Save the Changes to my Datatable
Code:
(temptable)