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. DataGird Can U help Me

DataGird Can U help Me

Scheduled Pinned Locked Moved C#
csharpwinformshelp
6 Posts 3 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
    AnhTin
    wrote on last edited by
    #1

    I want set CheckBox is Items of DataGird In WinForm Checkbox Items In A DataGrid WinForms C#

    P 1 Reply Last reply
    0
    • A AnhTin

      I want set CheckBox is Items of DataGird In WinForm Checkbox Items In A DataGrid WinForms C#

      P Offline
      P Offline
      Praveen Nayak
      wrote on last edited by
      #2

      You bind a datagrid to a data source to display contents on the grid. Usually a dataset gets bound to the grid. In this case, if one of the columns in the dataset is a boolean value, checkbox automatically appears for that boolean column in the datagrid. Ciao There has to be more to life than just this -- modified at 23:15 Thursday 23rd February, 2006

      A 1 Reply Last reply
      0
      • P Praveen Nayak

        You bind a datagrid to a data source to display contents on the grid. Usually a dataset gets bound to the grid. In this case, if one of the columns in the dataset is a boolean value, checkbox automatically appears for that boolean column in the datagrid. Ciao There has to be more to life than just this -- modified at 23:15 Thursday 23rd February, 2006

        A Offline
        A Offline
        AnhTin
        wrote on last edited by
        #3

        Can U give Source Demo ?? thanks

        P 1 Reply Last reply
        0
        • A AnhTin

          Can U give Source Demo ?? thanks

          P Offline
          P Offline
          Praveen Nayak
          wrote on last edited by
          #4

          try this. Note that dataGrid1 must be a DataGrid control that you dragged and dropped onto your form. using System.Data; ... private void MainForm_Load(object sender, System.EventArgs e) { DataSet ds = new DataSet(); ds.Tables.Add ("One"); ds.Tables[0].Columns.Add ("A"); ds.Tables[0].Columns.Add ("B"); ds.Tables[0].Columns[0].DataType = typeof (bool); ds.Tables[0].Columns[1].DataType = typeof (string); ds.Tables[0].Rows.Add (new object[] {true, "First"}); dataGrid1.DataSource = ds; } ... Hope this helps. There has to be more to life than just this

          A 1 Reply Last reply
          0
          • P Praveen Nayak

            try this. Note that dataGrid1 must be a DataGrid control that you dragged and dropped onto your form. using System.Data; ... private void MainForm_Load(object sender, System.EventArgs e) { DataSet ds = new DataSet(); ds.Tables.Add ("One"); ds.Tables[0].Columns.Add ("A"); ds.Tables[0].Columns.Add ("B"); ds.Tables[0].Columns[0].DataType = typeof (bool); ds.Tables[0].Columns[1].DataType = typeof (string); ds.Tables[0].Rows.Add (new object[] {true, "First"}); dataGrid1.DataSource = ds; } ... Hope this helps. There has to be more to life than just this

            A Offline
            A Offline
            AnhTin
            wrote on last edited by
            #5

            Thanks But I use DataGridTableStyle fill Data (Dataset->DataGird) Ex: DataGridTextBoxColumn dgColumn; DataGridTableStyle dgTablestyle=null; public void dgAddColum() { try { dgTablestyle.GridColumnStyles.Clear(); RemoveControlBindings(); AddDataControlBindings(); this.dgAssinStyle("dg_id","dg_id",dgTablestyle); this.dgAssinStyle("dg_name","dg_name",dgTablestyle); this.dgAssinStyle("dg_text","dg_text",dgTablestyle); this.dgAssinStyle("dg_info","dg_info",dgTablestyle); } catch(Exception ex) { MessageBox.Show(ex.Message); } } //Gan HeaderText, MappingName vao public void dgAssinStyle(string headerText, string mappingName, DataGridTableStyle tablestyle) { dgColumn = new DataGridTextBoxColumn(); dgColumn.HeaderText = headerText; dgColumn.MappingName = mappingName; tablestyle.GridColumnStyles.Add(dgColumn); } After Add Collum CheckBox to DataGird if U have a Ex for Me veryGood thanks:doh:

            M 1 Reply Last reply
            0
            • A AnhTin

              Thanks But I use DataGridTableStyle fill Data (Dataset->DataGird) Ex: DataGridTextBoxColumn dgColumn; DataGridTableStyle dgTablestyle=null; public void dgAddColum() { try { dgTablestyle.GridColumnStyles.Clear(); RemoveControlBindings(); AddDataControlBindings(); this.dgAssinStyle("dg_id","dg_id",dgTablestyle); this.dgAssinStyle("dg_name","dg_name",dgTablestyle); this.dgAssinStyle("dg_text","dg_text",dgTablestyle); this.dgAssinStyle("dg_info","dg_info",dgTablestyle); } catch(Exception ex) { MessageBox.Show(ex.Message); } } //Gan HeaderText, MappingName vao public void dgAssinStyle(string headerText, string mappingName, DataGridTableStyle tablestyle) { dgColumn = new DataGridTextBoxColumn(); dgColumn.HeaderText = headerText; dgColumn.MappingName = mappingName; tablestyle.GridColumnStyles.Add(dgColumn); } After Add Collum CheckBox to DataGird if U have a Ex for Me veryGood thanks:doh:

              M Offline
              M Offline
              Maqsood Ahmed
              wrote on last edited by
              #6

              Hello, Use DataGridBoolColumn for boolean columns by checking their DataType property HTH. Cheers. Maqsood Ahmed - MCAD.net Kolachi Advanced Technologies http://www.kolachi.net

              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