Hello All,

I have a windows app with two datagridviews on a form. The first
column in datagridview1 contains filenames. Using split i am parsing
the filenames into new variables to be displayed in datagridview2 (the
user has to select checkboxes in the last column of datagridview1 to
select which filenames to take this action on). So far my code is
working as expected. What i would like to do now, is to display the
original filename column (column 0) in the second datagridview as well
Column name=Name. I cannot seem to figure out how to do this. Below
please find my code. I hope this explanation is not too confusing.
Thanks for all your help.

-Nevin


        private void button3_Click(object sender, EventArgs e)
        {
            using (DataGridView grid = new DataGridView())
            {

                dataGridView2.AutoGenerateColumns = false;
                AddColumn(dataGridView2, "Name");
                AddColumn(dataGridView2, "Cycle");
                AddColumn(dataGridView2, "Type");
                AddColumn(dataGridView2, "Date");
                AddColumn(dataGridView2, "FIPS");

            }

            int rowindex = 0; string temp = "";
            dataGridView2.Rows.Clear();


            foreach (DataGridViewRow dr in dataGridView1.Rows)
            {
                if (Convert.ToBoolean (dr.Cells[4].Value) == true)
                {
                    temp = dr.Cells[0].Value.ToString();
                    string[] fields = temp.Split('_', '.');
                    dataGridView2.Rows.Insert(rowindex, fields);
                    rowindex = rowindex + 1;

                    ////Add combobox column to datagridview
                    DataGridViewComboBoxColumn ComboBoxColumn = new
                    DataGridViewComboBoxColumn();
                    ComboBoxColumn.HeaderText = "Site";
                    ComboBoxColumn.DataPropertyName = "siteCombo";

                    ComboBoxColumn.Items.Add("Atlanta");
                    ComboBoxColumn.Items.Add("Detroit");

                    dataGridView2.Columns.Add(ComboBoxColumn);


                    ////Add checkbox column to datagridview
                    DataGridViewCheckBoxColumn CheckBoxColumn = new
                    DataGridViewCheckBoxColumn();
                    CheckBoxColumn.HeaderText = "Select To Copy";
                    CheckBoxColumn.DataPropertyName = "cpyChkProp";
                    dataGridView2.Columns.Add(CheckBoxColumn);

                }
            }
        }

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"DotNetDevelopment, VB.NET, C# .NET, ADO.NET, ASP.NET, XML, XML Web 
Services,.NET Remoting" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://cm.megasolutions.net/forums/default.aspx
-~----------~----~----~----~------~----~------~--~---

Reply via email to