At runtime when the dgv is shown,then on clicking the header of a particular row of the dgv,i want to pop up a form...........how to do this?
please help
thank you
Printable View
At runtime when the dgv is shown,then on clicking the header of a particular row of the dgv,i want to pop up a form...........how to do this?
please help
thank you
initially this is my dgv when the form loads:
Attachment 75753
when i click a button the dgv is loaded with the values:
Attachment 75754
now when i click the header of a particular row of the dgv,then i want to show a form ......how to do this?
You have the ColumnHeaderMouseDoubleClick and ColumnHeaderMouseClick...
Just need to put there the statement to open the form.
but the dgv is loaded with the data at the runtime.....then how to do this?
its not the column header mickey.......when the user clicks the > arrow sign of my second image (just beside the first cell) then i want to show the form.....
Just use the mouse cell click/doubleclick event, and check what's the index of the column...
If the index of the column it's -1 then it's the header..
EDIT Example:
vb.net Code:
Private Sub DGV_CellMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DGV.CellMouseClick If e.RowIndex >= 0 AndAlso e.ColumnIndex = -1 Then 'Show your form End If End Sub
ok i did this:
it works but tell that should i use the select case hereCode:Private Sub DataGridView1_RowHeaderMouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridView1.RowHeaderMouseClick
Select Case e.RowIndex
Case e.RowIndex
Form2.Show()
Form2.TextBox1.Text = Me.DataGridView1.Rows(e.RowIndex).Cells("Name").Value
Form2.TextBox2.Text = Me.DataGridView1.Rows(e.RowIndex).Cells("Age").Value
Form2.TextBox3.Text = Me.DataGridView1.Rows(e.RowIndex).Cells("Roll").Value
Form2.TextBox4.Text = Me.DataGridView1.Rows(e.RowIndex).Cells("Sex").Value
End Select
Form2.Show()
End Sub
or
i should do the same using a loop?
though i pass the values between the two forms directly by this:
many use the property....get...setCode:Form2.TextBox1.Text = Me.DataGridView1.Rows(e.RowIndex).Cells("Name").Value
i cant understand the get...set properly....
can you explain the two mickey....
need your help