add and not add button "show data" in to Datagrid in C# ????
-
hi all. now, i have datagridview in C#. i want add fix data into Datatable and show on datagridview. But, in line 2, i set value all column blank and not add button "show data" in this row. in datagridview it alway add button in row, but i want it not add button in line i will choice. help me, please. private static DataTable MakeTable() { // Create a new DataTable titled 'Names.' DataTable namesTable = new DataTable("Names3"); //Add three column objects to the table. DataColumn ClassificationNumber3 = new DataColumn(); ClassificationNumber3.DataType = System.Type.GetType("System.String"); ClassificationNumber3.ColumnName = "ClassificationNumber3"; namesTable.Columns.Add(ClassificationNumber3); } private static DataTable GetTable() { DataTable dt; dt = MakeTable(); int i = 0; DataRow dr; try { for (i = 0; i < 20; i++) { dr = dt.NewRow(); // Then add the new row to the collection. if (i <= 6) { dr["ClassificationNumber3"] = "03J"; //DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); //btn.HeaderText = "Click Data"; //btn.Text = "Click Here"; //btn.Name = "button3"; //btn.UseColumnTextForButtonValue = true; //dataGridView3.Rows.Add(btn); } else if(i == 7) { dr["ClassificationNumber3"] = ""; } else { dr["ClassificationNumber3"] = "03K"; } dt.Rows.Add(dr); } thanks very much nothing
-
hi all. now, i have datagridview in C#. i want add fix data into Datatable and show on datagridview. But, in line 2, i set value all column blank and not add button "show data" in this row. in datagridview it alway add button in row, but i want it not add button in line i will choice. help me, please. private static DataTable MakeTable() { // Create a new DataTable titled 'Names.' DataTable namesTable = new DataTable("Names3"); //Add three column objects to the table. DataColumn ClassificationNumber3 = new DataColumn(); ClassificationNumber3.DataType = System.Type.GetType("System.String"); ClassificationNumber3.ColumnName = "ClassificationNumber3"; namesTable.Columns.Add(ClassificationNumber3); } private static DataTable GetTable() { DataTable dt; dt = MakeTable(); int i = 0; DataRow dr; try { for (i = 0; i < 20; i++) { dr = dt.NewRow(); // Then add the new row to the collection. if (i <= 6) { dr["ClassificationNumber3"] = "03J"; //DataGridViewButtonColumn btn = new DataGridViewButtonColumn(); //btn.HeaderText = "Click Data"; //btn.Text = "Click Here"; //btn.Name = "button3"; //btn.UseColumnTextForButtonValue = true; //dataGridView3.Rows.Add(btn); } else if(i == 7) { dr["ClassificationNumber3"] = ""; } else { dr["ClassificationNumber3"] = "03K"; } dt.Rows.Add(dr); } thanks very much nothing