Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. add and not add button "show data" in to Datagrid in C# ????

add and not add button "show data" in to Datagrid in C# ????

Scheduled Pinned Locked Moved C#
helpcsharpquestion
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    aa_zz
    wrote on last edited by
    #1

    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

    R 1 Reply Last reply
    0
    • A aa_zz

      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

      R Offline
      R Offline
      Ravi Sant
      wrote on last edited by
      #2

      Please re-format your question to reflect code in < pre > tags. Clearly say what you are saying, so that we may be able to help you.

      ♫ 99 little bugs in the code, 99 bugs in the code We fix a bug, compile it again 101 little bugs in the code ♫

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups