Private Sub AutoFitTextbox()
Dim command As New OleDbCommand("SELECT * FROM TABLE1 WHERE PRODUCT_ID = @PRODUCT_ID", mycn)
If TextBox1.Text IsNot "" Then
command.Parameters.Add("@PRODUCT_ID", OleDbType.VarChar).Value = TextBox1.Text
Dim adapater As New OleDbDataAdapter(command)
Dim table As New DataTable
adapater.Fill(table)
txtID.Text = ""
Product_List.Text = ""
Asset_ID.Text = ""
If table.Rows.Count() > 0 And table.Rows.Count() < 2 Then
If PictureBox1.Image IsNot Nothing Then (datagridview column)
Dim bytes As Byte() = CType(table.Rows(0)("Picture"),
Byte())
Dim ms As New MemoryStream(bytes)
PictureBox1.Image = Image.FromStream(ms)
txtID.Text = table.Rows(0)(0).ToString
Product_List.Text = table.Rows(0)(2).ToString
Asset_ID.Text = table.Rows(0)(3).ToString
else
txtID.Text = table.Rows(0)(0).ToString
Product_List.Text = table.Rows(0)(2).ToString
Asset_ID.Text = table.Rows(0)(3).ToString
End If
End Sub
I try to write code abou t a pictuebox. If the data column does not have a picture, it will not be displayed in the picture box. If there is, it will be displayed in the picture box. The data presented by my code is strange, please give pointers, thanks
my program current situation is if datagridview data column, picture column no picture it still can be display picture can someone give me an adviw