1

I have a VB coding issue. I have coded the datagridview to display both pictureb...

 2 years ago
source link: https://www.codeproject.com/Questions/5331578/I-have-a-VB-coding-issue-i-have-coded-the-datagrid
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

See more:

Expand ▼   Copy Code
Dim colname As String = DataGridView1.Columns(e.ColumnIndex).Name
            If colname = "colEdit" Then

                With frmProudctM
                    cn.Open()

                    cm = New MySqlCommand("select image, pid, description, category, costprice, sellingprice from tblproduct where pid like '" & DataGridView1.Rows(e.RowIndex).Cells(1).Value & " ' ", cn)
                    dr = cm.ExecuteReader()
                    While dr.Read
                        Dim len As Long = dr.GetBytes(0, 0, Nothing, 0, 0)
                        Dim arr(CInt(len)) As Byte
                        dr.GetBytes(0, 0, arr, 0, CInt(len))
                        Dim MS As New MemoryStream(arr)
                        Dim Bitmap As New Bitmap(MS)
                        .PictureBox1.Image = Bitmap
                        .lblpid.Text = dr.Item("pid").ToString
                        .txtDescription.Text = dr.Item("description").ToString
                        .cboCategory.Text = dr.Item("category").ToString
                        .txtCostPrice.Text = dr.Item("costprice").ToString
                        .txtSellingPrice.Text = dr.Item("sellingprice").ToString

                    End While
                    dr.Dispose()
                    cn.Close()
                    .btnSubmit.Visible = False
                    .btnUpdate.Visible = True
                    .ShowDialog()
                End With



What I have tried:

I have tried all means but still the same


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK