Learn how to a build a cloud-first strategyRegister Now


refresh form with datagridview

Posted on 2012-08-27
Medium Priority
Last Modified: 2012-08-29
I have a windform with DataGridView display a list of data with a DataGridViewButtonColumn. When I clicked the button, a popup window will display some info and I could make changes. And after I clicked a button in popup. Some data updated in DB. And popup closed. But the content of my DataGridView in first firm should have changed. But not updated I could not see the changes I made. I know I should update the form or the datasource of DataGridView so that I could see the changes after the popup closed. I tried this.update(); this.refresh(); invalidate.....Just not working correctly.
But It worked if I reload the form. The problem is I don't want to reload the whole form?

How to handle it? Appreciated!!
Question by:jssong2000
LVL 16

Accepted Solution

Rose Babu earned 2000 total points
ID: 38340287

Try this simple way.

in Form1, Write the data binding code in a subroutine

and at the end of the button click which is used to open popup form, call the binding subroutine process.

This will refresh the datagridview.

Try like this.

namespace WinAppCSHARP
    public partial class Form1 : Form
        public Form1()

        private void Form1_Load(object sender, EventArgs e)

        public void BindGrid()
            dataGridView1.DataSource = null;
            dataGridView1.DataSource = YourDataSource;            

        private void btnOpenPopup_Click(object sender, EventArgs e)
	    // Opens Popup window
            frmPopup frm = new frmPopup();

	    // Load DataGridView again

Open in new window


Author Closing Comment

ID: 38345995
It worked. Thank You!!!

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
Is your OST file inaccessible, Need to transfer OST file from one computer to another? Want to convert OST file to PST? If the answer to any of the above question is yes, then look no further. With the help of Stellar OST to PST Converter, you can e…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question