How do I refresh a data grid from a different form?

Posted on 2006-04-18
Last Modified: 2010-05-19

I'm using and VB.  I have form1 and form2. Form2 is opened from Form1.

 I update a table from form2, when I close out of the form2 (by clicking the X in the right hand corner), form1 displays.  How do I get the datagrid on Form1 to refresh so that it shows the updated information (updates to a table made from form2)?


Question by:jm76
    LVL 4

    Expert Comment

    Before closing form 2 refresh data grid in form 1 with data from form 2.  You should be able to do this on the form close method.

    Author Comment

    can you provide some example code?
    LVL 1

    Accepted Solution

    Using JavaScript
    In form1, you write javascript refreshing function e.g: refreshDg(){}, this is page refresh event.
    In Form2 you write like below

    <script language="javascript">
    function HandleOnClose() {
       if (event.clientY < 0) {
    <BODY onbeforeunload="HandleOnClose()">
    Hop this help

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Suggested Solutions

    Title # Comments Views Activity
    fizzArray  challenge 1 28
    wordsWithoutList  challenge 24 61
    matchUp  challenge 9 50
    Fibonacci challenge 11 61
    RIA (Rich Internet Application) tools are interactive internet applications which have many of the characteristics of desktop applications. The RIA tools typically deliver output either by the way of a site-specific browser or via browser plug-in. T…
    If you’re thinking to yourself “That description sounds a lot like two people doing the work that one could accomplish,” you’re not alone.
    An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
    In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

    760 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

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now