Hello, I have a windows forms app on vs2008 and I am currently trying to refresh the datagridview after an insert() command. By refresh I mean reflect new changes. I have tried everything I've read online. Nothing seems to work. Please post any thoughts, here is my code:
FinancialTableAdapter.Insert(Form1.intPID, DateTimePicker1.Value, cboDesc.Text, txtCPT.Text, txtMOD1.Text, txtMOD2.Text, txtPay.Text, txtFee.Text, Balance, False, False)
Form1.DataGridView1.EndEdit()
FinancialBindingSource.EndEdit()
FinancialTableAdapter.FillByintPID(EbtblsDataSet.Financial, Form1.intPID)
Form1.DataGridView1.DataSource = Nothing
Form1.DataGridView1.DataSource = EbtblsDataSet.Financial
Form1.DataGridView1.Refresh()
FinancialBindingSource.ResetBindings(False)
Form1.DataGridView1.Parent.Refresh()
Form1.DataGridView1.Refresh()
*What I have now does work, but since the datasource for dgv1 should be the binding source (i think?) when i make changes in the datagrid, they do not save like they're supposed to (this is when i'm editing things in the datagrid, NOT when i'm inserting new rows), when i remove this code everything saves as it should, but after inserting new data the datagrid does not refresh.
Datagridview1 is my datagrid that is not refreshing
FinancialBindingSource is its datasource
EbtblsDataSet is my dataset that the bindingsource and tableadapter are both apart of
EbtblsDataSet.Financial is the financial table that is reflected by the FinancialTableAdapter and FinancialBindingSource
This insertion appears on a separate form than the datagridview
Again, the way up there works but it does not work correctly, it will not save updated changes right when I do other things on the datagridview, so I do not want to reload the source like I have it up there
If I didn't provide enough info please let me know and i'll clarify on whatever else
Thanks for your help in advance!
FinancialTableAdapter.Insert(Form1.intPID, DateTimePicker1.Value, cboDesc.Text, txtCPT.Text, txtMOD1.Text, txtMOD2.Text, txtPay.Text, txtFee.Text, Balance, False, False)
Form1.DataGridView1.EndEdit()
FinancialBindingSource.EndEdit()
FinancialTableAdapter.FillByintPID(EbtblsDataSet.Financial, Form1.intPID)
Form1.DataGridView1.DataSource = Nothing
Form1.DataGridView1.DataSource = EbtblsDataSet.Financial
Form1.DataGridView1.Refresh()
FinancialBindingSource.ResetBindings(False)
Form1.DataGridView1.Parent.Refresh()
Form1.DataGridView1.Refresh()
*What I have now does work, but since the datasource for dgv1 should be the binding source (i think?) when i make changes in the datagrid, they do not save like they're supposed to (this is when i'm editing things in the datagrid, NOT when i'm inserting new rows), when i remove this code everything saves as it should, but after inserting new data the datagrid does not refresh.
Datagridview1 is my datagrid that is not refreshing
FinancialBindingSource is its datasource
EbtblsDataSet is my dataset that the bindingsource and tableadapter are both apart of
EbtblsDataSet.Financial is the financial table that is reflected by the FinancialTableAdapter and FinancialBindingSource
This insertion appears on a separate form than the datagridview
Again, the way up there works but it does not work correctly, it will not save updated changes right when I do other things on the datagridview, so I do not want to reload the source like I have it up there
If I didn't provide enough info please let me know and i'll clarify on whatever else
Thanks for your help in advance!