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. Web Development
  3. ASP.NET
  4. datagridview

datagridview

Scheduled Pinned Locked Moved ASP.NET
csharpdatabasemysql
5 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
    altafmohd
    wrote on last edited by
    #1

    i am devloping a project mysql query browser in dotnet with c #..... i have a datagridview in my form .. i have to create a table ... there are many columns like col name ,datatype ,not null,primary key and one col is auto increment .....in auto increment i am using checkbox col ....so i want that when user clicks in one rows aut inc col all other row auto inc col should be uncheck like it happens in mysql query browser but it is not happening in my projcet .... please if possible provide the code thanx in advance

    R J 2 Replies Last reply
    0
    • A altafmohd

      i am devloping a project mysql query browser in dotnet with c #..... i have a datagridview in my form .. i have to create a table ... there are many columns like col name ,datatype ,not null,primary key and one col is auto increment .....in auto increment i am using checkbox col ....so i want that when user clicks in one rows aut inc col all other row auto inc col should be uncheck like it happens in mysql query browser but it is not happening in my projcet .... please if possible provide the code thanx in advance

      R Offline
      R Offline
      R Giskard Reventlov
      wrote on last edited by
      #2

      Not very clear what you are trying to do and why it has gone wrong. There are plenty of examples of using check boxes in grids - you need to do a porper search on Google. You talk about an auto-increment column: what do you mean by this?

      "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

      A 1 Reply Last reply
      0
      • A altafmohd

        i am devloping a project mysql query browser in dotnet with c #..... i have a datagridview in my form .. i have to create a table ... there are many columns like col name ,datatype ,not null,primary key and one col is auto increment .....in auto increment i am using checkbox col ....so i want that when user clicks in one rows aut inc col all other row auto inc col should be uncheck like it happens in mysql query browser but it is not happening in my projcet .... please if possible provide the code thanx in advance

        J Offline
        J Offline
        Joshua Omundson
        wrote on last edited by
        #3

        Well it looks like from your post that you know you need to supply code for this. Have you written any code to uncheck the other boxes? If so, it would be benifical to see it to help further. Also let us know if you are getting any type of error messages, or what exactly is happening when you click the auto inc column.

        A 1 Reply Last reply
        0
        • R R Giskard Reventlov

          Not very clear what you are trying to do and why it has gone wrong. There are plenty of examples of using check boxes in grids - you need to do a porper search on Google. You talk about an auto-increment column: what do you mean by this?

          "If you think it's expensive to hire a professional to do the job, wait until you hire an amateur." Red Adair. nils illegitimus carborundum me, me, me

          A Offline
          A Offline
          altafmohd
          wrote on last edited by
          #4

          ok i will ....auto increment coloumn means only one row cell(auto inc col) will be check at a time ......like group radio button works :)

          1 Reply Last reply
          0
          • J Joshua Omundson

            Well it looks like from your post that you know you need to supply code for this. Have you written any code to uncheck the other boxes? If so, it would be benifical to see it to help further. Also let us know if you are getting any type of error messages, or what exactly is happening when you click the auto inc column.

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

            sir this is my code what i am using in my project .... there is a checkbox outside the gridview for checking the inside col cell of gridview and if i chk inside gridview col cell then it checks outside the gridview as it happens in mysql query browser .....thnx in advance

            private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
            {
            try
            {
            q = (string)dataGridView1.CurrentRow.Cells[0].Value;
            if (q != null)
            {
            cntextbox.Text = (string)dataGridView1.CurrentRow.Cells[0].Value;
            dttextbox.Text = (string)dataGridView1.CurrentRow.Cells[1].Value;

                            if (Convert.ToBoolean(dataGridView1.CurrentRow.Cells\[4\].Value) == true)
                                checkBox1.Checked = true;
                            else
                                checkBox1.Checked = false;
            
                            if (Convert.ToBoolean(dataGridView1.CurrentRow.Cells\[2\].Value) == true)
                                checkBox2.Checked = true;
                            else
                                checkBox2.Checked = false;
                            if (Convert.ToBoolean(dataGridView1.CurrentRow.Cells\[3\].Value) == true)
                            {
                                foreach (DataGridViewRow dr in dataGridView1.Rows)
                                {
                                    dr.Cells\[3\].Value = false;
                                }
                                checkBox3.Checked = true;
                            }
                            else
                                checkBox3.Checked = false;
            
            
            
            
                        }
            
            
            
            
            
            
                    }
            
                    catch (Exception)
                    {
            
                    }
            
            
                }
            
            
            
            
                private void checkBox1\_CheckedChanged(object sender, EventArgs e)
                {
                    if (checkBox1.Checked)
                        dataGridView1.CurrentRow.Cells\[4\].Value = true;
                    else
                        dataGridView1.CurrentRow.Cells\[4\].Value = false;
                }
            
                private void checkBox2\_CheckedChanged(object sender, EventArgs e)
                {
                    if (checkBox2.Checked)
                        dataGridView1.CurrentRow.Cells\[2\].Value = true;
                    else
                        dataGridView1.CurrentRow.Cells\[2\].Value = false;
                }
            
                private void dttextbox\_TextChanged(object sender, EventArgs e)
                {
                    dataGridView1.CurrentRow.Cells\[1\].Value = dttextbox.Text;
                }
            
                private void cntextbox\_TextChanged(obj
            
            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