1 Replies - 4994 Views - Last Post: 23 September 2012 - 04:03 PM Rate Topic: -----

#1 hiral2cool  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 13
  • Joined: 15-July 12

Refresh The Data in DataGrid View Instantly

Posted 23 September 2012 - 10:34 AM

https://dl.dropbox.c...atagridview.png

Here is the Image...
my data fill
now i will add On the Add Button
then my Data Will Be Refresh In The Back side of Grid View..

and Grid View is in the MDIparent...

and my ADD code is ...



this.Close();
                Client_Master_Grid.dtClientMaster.Rows.Clear();
                String load = "select ClientID,ClientName,Gender,Age,Address,State,City,Pincode,Phone,Mobile,EmailID,Remark from ClientMasterTbl";
                SqlDataAdapter adpt = new SqlDataAdapter(load, conn);
                adpt.Fill(Client_Master_Grid.dtClientMaster);
                Client_Master_Grid.dgClientMaster.DataSource = Client_Master_Grid.dtClientMaster;
                Client_Master_Grid cmg = new Client_Master_Grid();

cmg.refresh();




but refresh is done
but not Instanlty..in back end side

Attached image(s)

  • Attached Image

This post has been edited by Skydiver: 23 September 2012 - 03:59 PM
Reason for edit:: Put code in code tags.


Is This A Good Question/Topic? 0
  • +

Replies To: Refresh The Data in DataGrid View Instantly

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3647
  • View blog
  • Posts: 11,415
  • Joined: 05-May 12

Re: Refresh The Data in DataGrid View Instantly

Posted 23 September 2012 - 04:03 PM

On lines 7-9 you are creating an new instance of the grid and calling refresh() (sic). Unless your Client_Master_Grid class relies on globals or static member variables, how are you expecting the call to that new instance to affect the existing instance?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1