Member Avatar for spot_1

cant upload code

Member Avatar for spot_1

sdfsdfsd

On the top of your new post you see some buttons. Click on the code button, paste your code in the window that opens.

Member Avatar for spot_1
DataTable dtabl = new DataTable();
        DataSet ds = new DataSet();
        DataSet dS = new DataSet();
        private void Form1_Load(object sender, EventArgs e)
        {

            string[] zones =ConfigurationManager.AppSettings["TimeZones"].Split(',');
            Timecombo.DataSource = zones;
            dS.ReadXml("xml.xml");
            dataGridView1.DataSource = dS.Tables[2];
            dataGridView1.Rows[0].Cells[0].Value=
            Departcombo.SelectedIndex = 0;
            DataGridViewButtonColumn btn = new DataGridViewButtonColumn();
            btn.Text = "Save";
            btn.UseColumnTextForButtonValue = true;
            dataGridView1.Columns.Add(btn);
            DataGridViewButtonColumn priority = new DataGridViewButtonColumn();
            priority.Text = "ALL Priority to 1";
            priority.UseColumnTextForButtonValue = true;
            dataGridView1.Columns.Add(priority);
            DataGridViewButtonColumn createparts = new DataGridViewButtonColumn();
            createparts.Text = "Create Parts";

            createparts.UseColumnTextForButtonValue = true;
            dataGridView1.Columns.Add(createparts);

            label3.Visible = false;
            label5.Visible = false;
            label7.Visible = false;
            btnsave.Visible = false;
            btnClose.Visible = false;

        }

        private DataTable GetDataTableFromDGV(DataGridView dataGridView1)
        {
             var dt = new DataTable();
            foreach (DataGridViewColumn column in dataGridView1.Columns)
            {
                 if (column.Visible)
                 {
                     dt.Columns.Add(column.HeaderText);
                 }
            }

             object[] cellValues = new object[dataGridView1.Columns.Count];
             foreach (DataGridViewRow row in dataGridView1.Rows) 
            {
                    for (int i = 0; i < 9; i++) 
                       {
                            cellValues[i] = row.Cells[i].Value;
                       }
                        dt.Rows.Add(cellValues);
            }

                    return dt;
        }

Line 2 ds, line3 dS. This is calling for disaster. Give meaningful name to ALL your variables. I could never infer in my life what ds or dS are standing for.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.