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. Visual Basic
  4. how to make a button on a datagrid cell...

how to make a button on a datagrid cell...

Scheduled Pinned Locked Moved Visual Basic
tutorial
6 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.
  • C Offline
    C Offline
    cutequencher
    wrote on last edited by
    #1

    please give me some code or sample on how to make a button on a datagrid cell. thnx!

    R 1 Reply Last reply
    0
    • C cutequencher

      please give me some code or sample on how to make a button on a datagrid cell. thnx!

      R Offline
      R Offline
      Rupesh Kumar Swami
      wrote on last edited by
      #2

      hi, you can make a button on datagridview very easily at desigen time. when you add a column to datagridview , change its type to DatagridViewButtonColumn. if you want to add column at run time then use following code Dim ColumnButton As New DataGridViewButtonColumn columnButton.headertext="Your Heading" DataGridView1.Columns.Add(columnButton) Hope this helps

      Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

      C 2 Replies Last reply
      0
      • R Rupesh Kumar Swami

        hi, you can make a button on datagridview very easily at desigen time. when you add a column to datagridview , change its type to DatagridViewButtonColumn. if you want to add column at run time then use following code Dim ColumnButton As New DataGridViewButtonColumn columnButton.headertext="Your Heading" DataGridView1.Columns.Add(columnButton) Hope this helps

        Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

        C Offline
        C Offline
        cutequencher
        wrote on last edited by
        #3

        i want to know both ways... can you please tell me how could i be able to do that on design time? thank you so much!

        R 1 Reply Last reply
        0
        • C cutequencher

          i want to know both ways... can you please tell me how could i be able to do that on design time? thank you so much!

          R Offline
          R Offline
          Rupesh Kumar Swami
          wrote on last edited by
          #4

          after adding buttonTypecolumn to datagridview ,perform following action suppose index of buttonTypeColumn is 5 (whether you add column at design time or run time) Private Sub DataGridView1_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick If e.ColumnIndex = 5 Then msgbox "Button Type column of Datagridview is clicked" endif end sub hope this helps

          Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

          1 Reply Last reply
          0
          • R Rupesh Kumar Swami

            hi, you can make a button on datagridview very easily at desigen time. when you add a column to datagridview , change its type to DatagridViewButtonColumn. if you want to add column at run time then use following code Dim ColumnButton As New DataGridViewButtonColumn columnButton.headertext="Your Heading" DataGridView1.Columns.Add(columnButton) Hope this helps

            Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

            C Offline
            C Offline
            cutequencher
            wrote on last edited by
            #5

            i am using a plain datagrid... and the code is not effective... Dim ColumnButton As New DataGridViewButtonColumn -- generate an error ive already change it to Dim ColumnButton As New DataGridButtonColumn but its still not working...

            R 1 Reply Last reply
            0
            • C cutequencher

              i am using a plain datagrid... and the code is not effective... Dim ColumnButton As New DataGridViewButtonColumn -- generate an error ive already change it to Dim ColumnButton As New DataGridButtonColumn but its still not working...

              R Offline
              R Offline
              Rupesh Kumar Swami
              wrote on last edited by
              #6

              hello cutequencher, sorry for misunderstanding. This code is for datagridview i have no idea about DataGrid. so wait reply from others

              Rupesh Kumar Swami Software Engineer, Integrated Solution, Bikaner (India)

              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