Results 1 to 4 of 4

Thread: [RESOLVED] make datagrid cell clickable

  1. #1

    Thread Starter
    Junior Member
    Join Date
    Apr 2011
    Posts
    26

    Resolved [RESOLVED] make datagrid cell clickable

    after pulling the data into the datagrid. how can i make the cell clickable ,like if i select any cell ,the new form should come up.

    im using ms access 2007

  2. #2
    PowerPoster make me rain's Avatar
    Join Date
    Sep 2008
    Location
    india/Hubli
    Posts
    2,208

    Re: make datagrid cell clickable

    vb Code:
    1. Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick
    2.  
    3.         'this where you have clicked
    4.         'i have added an button column to the grid
    5.  
    6.         MessageBox.Show("Here is your row id " & e.RowIndex & Environment.NewLine & " Here is column indes " & e.ColumnIndex)
    7.  
    8.         If e.RowIndex = 0 And e.ColumnIndex = 0 Then
    9.             'here you will  open a nrew form
    10.             'so the condition is
    11.             'if the row is 0, and column is 0 that means if the user
    12.             'clicks on specific cell
    13.             'then open some form
    14.  
    15.             MessageBox.Show("Ypur form is opened here")
    16.         End If
    17.     End Sub
    The averted nuclear war
    My notes:

    PrOtect your PC. MSDN Functions .OOP LINUX forum
    .LINQ LINQ videous
    If some one helps you please rate them with out fail , forum doesn't expects any thing other than this

  3. #3

    Thread Starter
    Junior Member
    Join Date
    Apr 2011
    Posts
    26

    Re: make datagrid cell clickable

    okey its fine.
    actually i have enabled sorting in the datagridview. if i code using above code then after sorting the cells
    will be same but data in there will be sorted accordingly. for instance if on the top there is a name " abc" and after sorting there may be "zdt" ,now if person click on "zdt" he will get data of "abc". i have you get the point. any solution for this?

    thanx anyway

  4. #4

    Thread Starter
    Junior Member
    Join Date
    Apr 2011
    Posts
    26

    Re: make datagrid cell clickable

    I sorted out this problem, thank you . I am writing it here for others who has the same problem as me.

    DataGridView1.CurrentRow.Cells("DataGridViewTextBoxColumn").Value

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width