2 Replies - 1005 Views - Last Post: 01 June 2012 - 11:18 AM Rate Topic: -----

#1 Khavy-Lao  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-February 12

question: show Picture on Picturebox from (DataGridView_CellMouseUp)

Posted 31 May 2012 - 10:28 PM

Posted Image
I would like to show Picture on Picturebox from (DataGridView_CellMouseUp)???
    '****************************** ສະແດງ ຂໍ້ມູນ ນັກສຶກສາ ໃນ DataGridView "dgvStudent" ********************************
    Private Sub FormatdgvStudent() ' ຮູບແບບ ການ ສະແດງ ຂອງ DataGridView
        With dgvStudent
            If .RowCount > 0 Then
                .Columns(0).HeaderText = "ລະຫັດນັກສຶກສາ"
                .Columns(1).HeaderText = "ຄຳນຳໜ້າ"
                .Columns(2).HeaderText = "ຊື່-ນາມສະກຸນ"
                '.Columns(3).HeaderText = "ລະຫັດຊັ້ນຮຽນ"
                .Columns(4).HeaderText = "ເພດ"
                .Columns(5).HeaderText = "ເລກບັດປະຈຳຕົວ"
                .Columns(6).HeaderText = "ທີ່ຢູ່"
                .Columns(7).HeaderText = "ແຂວງ"
                .Columns(8).HeaderText = "ເບີໂທ"
                .Columns(9).HeaderText = "ວັນເກີດ"


                .Columns(0).Width = 140
                .Columns(1).Width = 140
                .Columns(2).Width = 140
                .Columns(3).Visible = False
                .Columns(4).Width = 80
                .Columns(5).Width = 120
                .Columns(6).Width = 100
                .Columns(7).Width = 100
                .Columns(8).Width = 100
                '.Columns(9).Visible = False ' ເຊື່ອງຊ້ອນ Field ວັນເກີດບໍ່ບໍ່ໃຫ້ເຫັນ
                .Columns(9).Width = 140
                .Columns(10).Visible = False ' ເຊື່ອງຊ້ອນ Field ຮູບພາບບໍ່ບໍ່ໃຫ້ເຫັນ

            End If
        End With
    End Sub

  
    Private Sub dgvStudent_CellMouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles dgvStudent.CellMouseUp
        If e.RowIndex = -1 Then Exit Sub 'ຖ້າ DataGridView "dgvStudent" ບໍ່ບໍ່ບໍ່ ບໍ່ບໍ່ມີ ຈັກແຖວເລີຍ
      

        With dgvStudent

            Select Case cboSearch.SelectedIndex
                Case 0 'ຖ້າ ເລືອກ: Case 0 ໃຫ້ສະແດງ : CustomerID ຢູ່ທີ່: tsSearch.Text
                    tsSearch.Text = .Rows.Item(e.RowIndex).Cells(0).Value.ToString()
                Case 1 'ຖ້າ ເລືອກ: Case 1 ໃຫ້ສະແດງ : ຊື່ ນັກສຶກ ຢູ່ທີ່: tsSearch.Text
                    tsSearch.Text = .Rows.Item(e.RowIndex).Cells(2).Value.ToString()
            End Select


            If dgvStudent.Rows.Item(e.RowIndex).Cells(4).Value.ToString = "M" Then
                optMale.Checked = True
            ElseIf dgvStudent.Rows.Item(e.RowIndex).Cells(4).Value.ToString = "F" Then
                optFemale.Checked = True
            End If


            lblCustomerID.Text = .Rows.Item(e.RowIndex).Cells(0).Value.ToString()
            cboInitial.Text = .Rows.Item(e.RowIndex).Cells(1).Value.ToString()
            txtFullName.Text = .Rows.Item(e.RowIndex).Cells(2).Value.ToString()

            mskIDCard.Text = .Rows.Item(e.RowIndex).Cells(5).Value.ToString()
            txtAddress.Text = .Rows.Item(e.RowIndex).Cells(6).Value.ToString()
            cboProvince.Text = .Rows.Item(e.RowIndex).Cells(7).Value.ToString()
            txtTelephone.Text = .Rows.Item(e.RowIndex).Cells(8).Value.ToString()
            dtpBirthdate.Value = CDate(.Rows.Item(e.RowIndex).Cells(9).Value.ToString())


            tsSearch.Focus()
            tsSearch.SelectAll()
        End With
    End Sub




Is This A Good Question/Topic? 0
  • +

Replies To: question: show Picture on Picturebox from (DataGridView_CellMouseUp)

#2 Khavy-Lao  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 22-February 12

Re: question: show Picture on Picturebox from (DataGridView_CellMouseUp)

Posted 31 May 2012 - 10:33 PM

Picturebox = picCustomerPicture
.Columns(11).Width = 100
Was This Post Helpful? 0
  • +
  • -

#3 ricardosms  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 73
  • View blog
  • Posts: 301
  • Joined: 02-April 10

Re: question: show Picture on Picturebox from (DataGridView_CellMouseUp)

Posted 01 June 2012 - 11:18 AM

May this will help you:

http://www.dreaminco...1&#entry1489234
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1