Quantcast
Channel: VBForums
Viewing all articles
Browse latest Browse all 16044

Cell Click Event

$
0
0
Hi,

I have a datagridview and on cell click event, the following code is executed...

Code:

Private Sub DgTenantDetails_CellMouseClick(sender As System.Object, e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DgTenantDetails.CellMouseClick

        Dim conn As SqlConnection = GetDbConnection()

        Call TenantsDetailsDisable()
        BtnUpdate.Enabled = False

        If e.RowIndex >= 0 Then

            Dim img As Byte()
            img = DgTenantDetails.Item(6, e.RowIndex).Value
            'img = DgTenantDetails.Rows(e.RowIndex).Cells(6).Value
            Dim ms As New MemoryStream(img)


            Dim row As DataGridViewRow = DgTenantDetails.Rows(e.RowIndex)

            TxtFNameUp.Text = row.Cells(1).Value.ToString
            TxtLNameUp.Text = row.Cells(2).Value.ToString
            TxtTelUp.Text = row.Cells(3).Value.ToString
            TxtEmailUp.Text = row.Cells(4).Value.ToString
            TxtNationalIDUp.Text = row.Cells(5).Value.ToString
            PictureBox2.Image = Image.FromStream(ms)
            PictureBox2.SizeMode = PictureBoxSizeMode.StretchImage

        End If
    End Sub

Code:

Private Sub TenantsDetailsDisable()

        PTUpdate.Visible = True
        PNTenant.Visible = False
        TxtFNameUp.ReadOnly = True
        TxtLNameUp.ReadOnly = True
        TxtTelUp.ReadOnly = True
        TxtEmailUp.ReadOnly = True
        TxtNationalIDUp.ReadOnly = True
        BtnUpload2.Enabled = False
        BtnEdit.Enabled = True
    End Sub

Now, when I click the column header on the datagridview it sets the panel - PTUpdate to be visible with no text in the textboxes.

What I want to happen is that when the column header is clicked nothing happens, i.e., PTUpdate visible is still False.

Thanks

Viewing all articles
Browse latest Browse all 16044

Trending Articles