|
-
Apr 27th, 2011, 10:08 PM
#1
Thread Starter
Junior Member
[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
-
Apr 28th, 2011, 08:25 AM
#2
Re: make datagrid cell clickable
vb Code:
Private Sub DataGridView1_CellClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellContentClick 'this where you have clicked 'i have added an button column to the grid MessageBox.Show("Here is your row id " & e.RowIndex & Environment.NewLine & " Here is column indes " & e.ColumnIndex) If e.RowIndex = 0 And e.ColumnIndex = 0 Then 'here you will open a nrew form 'so the condition is 'if the row is 0, and column is 0 that means if the user 'clicks on specific cell 'then open some form MessageBox.Show("Ypur form is opened here") End If End Sub
-
Apr 30th, 2011, 05:52 AM
#3
Thread Starter
Junior Member
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
-
May 5th, 2011, 12:47 PM
#4
Thread Starter
Junior Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|