Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7799937
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T00:28:16+00:00 2026-06-02T00:28:16+00:00

I have 2 data grid views (ValidationRun is master, Results is detail). I am

  • 0

I have 2 data grid views (ValidationRun is master, Results is detail). I am binding this to a dataset which I know contains data – I can see it when I debug. However, I get not data in the grids.

Any ideas?

/class level objects
private DataGridView dgvValidationRun = new DataGridView();
private BindingSource bsValidationRun = new BindingSource();
private DataGridView dgvResults = new DataGridView();
private BindingSource bsResults = new BindingSource();

private void Form1_Load(object sender, EventArgs e)    
    {    

        // Bind the DataGridView controls to the BindingSource    
        // components and load the data from the database.    
        dgvValidationRun.DataSource = bsValidationRun;    
        dgvResults.DataSource = bsResults;    
        GetData();    

        // Resize the master DataGridView columns to fit the newly loaded data.    
        dgvValidationRun.AutoResizeColumns();    

        // Configure the details DataGridView so that its columns automatically    
        // adjust their widths when the data changes.    
        dgvResults.AutoSizeColumnsMode =    
            DataGridViewAutoSizeColumnsMode.AllCells;    

    }

private void GetData()    
    {    
        try    
        {    
            SqlConnection connection = new SqlConnection(ConfigurationManager.ConnectionStrings["XMLValidate.Properties.Settings.ValidationResultsConnectionString"].ConnectionString);    

            // Create a DataSet.    
            DataSet data = new DataSet();    
            data.Locale = System.Globalization.CultureInfo.InvariantCulture;    

            // Add data from the Customers table to the DataSet.    
            SqlDataAdapter daValidationRun = new SqlDataAdapter("select * from ValidationRun", connection);    
            daValidationRun.Fill(data, "ValidationRun");    

            // Add data from the Orders table to the DataSet.    
            SqlDataAdapter daResults = new SqlDataAdapter("select * from Result", connection);    
            daResults.Fill(data, "Result");    

            // Establish a relationship between the two tables.    
            DataRelation relRunResult = new DataRelation("RunResult",    
                data.Tables["ValidationRun"].Columns["RunId"],    
                data.Tables["Result"].Columns["RunId"]);    
            data.Relations.Add(relRunResult);    

            // Bind the run data connector to the Run table.    
            bsValidationRun.DataSource = data;    
            bsValidationRun.DataMember = "ValidationRun";    

            // Bind the results data connector to the results data connector,    
            // using the DataRelation name to filter the information in the     
            // details table based on the current row in the master table.     
            bsResults.DataSource = bsValidationRun;    
            bsResults.DataMember = "RunResult";    

            dgvValidationRun.AutoGenerateColumns = true;    
            dgvValidationRun.Refresh();    
        }    
        catch (Exception ex)    
        {    
            int i = 1;    
        }    
    }
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T00:28:18+00:00Added an answer on June 2, 2026 at 12:28 am

    Many thanks nawfal, that was the problem. I had a couple of data grids that I’d added to the form via the designer but forgot to give them the same name as the code-behind – doh!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data grid view with images loaded into it. The table which
Is it possible to have something like Data Grid or Grid View control in
i have a doubt in grid view. In Data list we have a property
I have a gridview data and this gridview have subgrid too. in the first
I have a gridview, the contents of which are provided by accessdatasource the data
I have a Data grid with DatagridComboBoxColumn , and i want to Fire Event
I have a domain data model which returns a class such as the following:
I have a list view that is displaying data using the gridview. This list
I have a data grid view in one windows form named GridViewForm. When the
I’m working on a form that has a few data grid views that are

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.