forum

Home / DeveloperSection / Forums / Datagridview dont get update of DataTable

Datagridview dont get update of DataTable

kap roma 2546 25-Jul-2014
Hello,
At first i fill of my Main_GUI-Class a DataTable in my "Controler"-Class.
Methode of "Controller"-Class returns DataTable to the GUI-Class:

A Problem is, when i update my DataTable in my "Controler"-Class of some other GUI-Class, my Main_GUI-Class does not show me new Data on the Grid.

That is my Code:

public class Controller{
        DataTable globalDataTable
public DataTable updateData(string param){
        
globalDataTable = sqlClass.getSQLData(); 

}
}
public partial class mainGUI: Form
{
Controller myController;
private void mainGUI_Load(object sender, EventArgs e) {
          myController = new Controller();
                 myGrid.DataSource = myController.updateData("111"); //now Grid shows me Data from DataBase.
}
}
public partial class subGUI: Form
{
Controller control;
        
        public void initilize(Controller cr){
this.control = cr;
       }       
        private void sub_Load(object sender, EventArgs e) {
         
             //...
        }
        
        private void someMethode(){
control.updateData("222"); //now i change my DataTable on "Controller"-Class
//but the mainGUI does not recognize new Data and does not show these on Main-gui
       }

}

How can i solve this problem???
Thanks

c# c# 
Updated on 28-Jul-2014

Can you answer this question?


Answer

3 Answers

Liked By