I'm trying to update/refresh my data grid but it doesn't seem to update whenever there's a new entry. I've search the net about it and they were talking about databind(). I can't seem to have that in my datagrid. My intellisense only shows DataBindings not databind(). here's my code (when button is clicked):

dataGridRecords.DataSource = null;
            dataGridAlarm.DataSource = null;
            dataGridViolations.DataSource = null;
            dataGridDriverInf.DataSource = null;
            dataGridRecords.DataSource = dbc.ds.Tables["Records"].DefaultView;
            dataGridViolations.DataSource = dbc.ds.Tables["Violations"].DefaultView;
            dataGridDriverInf.DataSource = dbc.ds.Tables["DriverInfo"].DefaultView;

then i also tried this (i've also tried refresh(),refreshedit()):

dataGridRecords.DataSource = null;
            dataGridAlarm.DataSource = null;
            dataGridViolations.DataSource = null;
            dataGridDriverInf.DataSource = null;
            dataGridRecords.Update();
            dataGridViolations.Update();
            dataGridDriverInf.Update();
            dataGridRecords.DataSource = dbc.ds.Tables["Records"].DefaultView;
            dataGridViolations.DataSource = dbc.ds.Tables["Violations"].DefaultView;
            dataGridDriverInf.DataSource = dbc.ds.Tables["DriverInfo"].DefaultView;

can anyone tell me how to get this right? it's not updating.

Recommended Answers

All 3 Replies

Hi,

Try by removing 'DefaultView'.

It's still the same. It's not working . ='(

I got it working now. I just used the GetChanges() and AcceptChanges() method for the dataset :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.