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

  • SEARCH
  • Home
  • 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 3239980
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T18:01:59+00:00 2026-05-17T18:01:59+00:00

I am new at this. I am trying to populate a datagrid from a

  • 0

I am new at this. I am trying to populate a datagrid from a table source. My code is attempting to do two things.
First it populates a dataGrid with columns from a table. Then it adds a column called “SELECT” at the end of the grid. This select is CheckBox. However, when I execute this code, it adds the “SELECT” column twice.
I want to see it once. What am I doing wrong?

private void BankFlow_Load(object sender, EventArgs e)
{
    initMethod();
    dataTable = getBankFlowData(globalConnection);
    dataGridView1.DataSource = dataTable;
}

private static DataTable getBankFlowData(OracleConnection oc)
{
    DataTable dt = new System.Data.DataTable();
    try
    {

        OracleCommand od = oc.CreateCommand();
        od.CommandText = "SELECT * FROM BANK_FLOW_SOURCE";
        od.CommandType = System.Data.CommandType.Text;
        OracleDataAdapter adapter = new OracleDataAdapter(od);
        adapter.Fill(dt);

    }
    catch (Exception)
    { 

    }
    return dt;
}

private static void initMethod()
{
    targetSystem = ConfigurationManager.ConnectionStrings["prototype"].ConnectionString.ToString();
    Console.WriteLine("Target : {0}", targetSystem);
    sourceSystem = ConfigurationManager.ConnectionStrings["qlprod8"].ConnectionString.ToString();
    Console.WriteLine("Source : {0}", sourceSystem);

    globalConnection.ConnectionString = sourceSystem;
    globalConnection.Open();
}

private void dataGridView1_DataBindingComplete(object sender, DataGridViewBindingCompleteEventArgs e)
{
    DataGridViewCheckBoxColumn col = new DataGridViewCheckBoxColumn();
    col.HeaderText = "SELECT";
    col.ReadOnly = false;
    col.DefaultCellStyle.BackColor = Color.Beige;
    dataGridView1.Columns.Add(col);
}
  • 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-05-17T18:01:59+00:00Added an answer on May 17, 2026 at 6:01 pm

    Your problem is that the databindingcomplete event happens more then you think. In fact anytime some data changes it will fire.

    You need to add the column outside of the databindingcomplete event.

    EDIT

    Actually since you are databinding, you may want to consider adding the column to your datatable. You would do this before the binding the datatable to the grid. Essentially, just create a datacolumn named select, that has the type of boolean and then add the datacolumn to the datatable.

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

Sidebar

Related Questions

I'm trying to populate a JSP dropdown from a database table. Here's the code
I am trying to populate data from database into a TextView using this code:
I'm trying to populate a new table with records from 2 other tables. period_states
I'm trying to populate new select menu (#school) from db table based on previous
I am new at this :) I am trying to load a picture from
I am new to Django and was trying this code in a tutorial. But
I am trying to populate Combox like this : DataSet ds = new DataSet();
I'm trying to populate a listview from another class, but I'm geting this error:
I am trying to populate a datagrid from a .txt file. I managed to
I'm trying to populate listview from my SQLite database... this is how I get

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.