 |
|
vb.net จะแสดงรูปเวลาคลิกเลือกข้อมูลแต่ละรายการมาแสดงใน picturebox ต้องทำไงครับ |
|
 |
|
|
 |
 |
|
ข้อมูลรูปภาพถูกบันทึกไว้ใน db เรียบร้อยแล้ว แต่ต้องการให้แสดงเวลาเราคลิกเลือกข้อมูลแต่ละรายการ
ปัญหาคือ ข้อมูลที่เป็นตัวอักษรแสดงทุกอย่าง แต่รูปภาพไม่แสดง ผมต้องการให้มันแสดงเวลาคลิกเลือกแต่ละรายการ
ผู้รู้ช่วยทีครับ
ตัวที่ผมคอมเม้นไว้ผมลองตัวแล้วแต่ยังไม่ได้
Code (VB.NET)
Private Sub DataGridViewWeddingDress_CellMouseUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellMouseEventArgs) Handles DataGridViewWeddingDress.CellMouseUp
If e.RowIndex = -1 Then
Exit Sub
End If
With DataGridViewWeddingDress
TextBoxWeddingDressID.Text = .Rows(e.RowIndex).Cells(0).Value.ToString()
TextBoxWeddingDressName.Text = .Rows(e.RowIndex).Cells(1).Value.ToString()
TextBoxWeddingDressQty.Text = .Rows(e.RowIndex).Cells(2).Value.ToString()
TextBoxWeddingDressPrice.Text = .Rows(e.RowIndex).Cells(3).Value.ToString()
TextBoxWeddingDressDay.Text = .Rows(e.RowIndex).Cells(4).Value.ToString()
PictureBox1.Image = ""
' Dim cn As New SqlConnection(ConStr)
' Dim cmd As New SqlCommand("SELECT WeddingID, " & _
'"Picture FROM TableWedding ORDER BY WeddingID", cn)
' Dim da As New SqlDataAdapter(cmd)
'Dim ds As New DataSet()
'da.Fill(ds, "TableWedding")
' Dim c As Integer = ds.Tables("TableWedding").Rows.Count
'If c > 0 Then
'Dim bytBLOBData() As Byte = _
' ds.Tables("TableWedding").Rows(c - 3)("Picture")
' Dim stmBLOBData As New MemoryStream(bytBLOBData)
' PictureBox1.Image = Image.FromStream(stmBLOBData)
' End If
' PictureBox1.Image = ByteToImage(Of Byte)()
' Dim cn As New SqlConnection(ConStr)
' Dim cmd As New SqlCommand("SELECT WeddingID, " & _
'"Picture FROM TableWedding ORDER BY WeddingID", cn)
' Dim dr As SqlDataReader
' cn.Open()
' dr = cmd.ExecuteReader(CommandBehavior.CloseConnection)
' If dr.Read Then
'Dim bytBLOBData(dr.GetBytes(1, 0, Nothing, 0, Integer.MaxValue) - 1) As Byte
' dr.GetBytes(1, 0, bytBLOBData, 0, bytBLOBData.Length)
' Dim stmBLOBData As New MemoryStream(bytBLOBData)
' PictureBox1.Image = Image.FromStream(stmBLOBData)
' End If
' dr.Close()
End With
End Sub
1 หน้าจอ

2 ภาพที่บรรทึกไว้ในตารางแล้ว

Tag : Ms SQL Server 2008, VB.NET
|
ประวัติการแก้ไข 2013-03-10 03:03:53
|
 |
 |
 |
 |
Date :
2013-03-10 02:58:32 |
By :
leksoft |
View :
2013 |
Reply :
8 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทำตามทุกอันแล้ว ยังไม่ได้เลย
|
 |
 |
 |
 |
Date :
2013-03-10 13:46:31 |
By :
leksoft |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ติดปัญหาตรงไหนครับ ตาม concept แค่แปลงให้เป็น Binary แล้วเอาไปใส่ picture box ก็น่าจะได้แล้วน่ะครับ
|
 |
 |
 |
 |
Date :
2013-03-10 16:04:19 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ไม่รู้ว่าเป็นที่เวอร์ชั่นหรือป่าว ของผม vb 2010

|
ประวัติการแก้ไข 2013-03-10 19:13:10
 |
 |
 |
 |
Date :
2013-03-10 19:03:08 |
By :
leksoft |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
อันนี้สำหรับ ASP.NET น่ะครับ
|
 |
 |
 |
 |
Date :
2013-03-11 06:50:40 |
By :
mr.win |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
มี vb.net หรือป่าวคับ
|
 |
 |
 |
 |
Date :
2013-03-11 10:02:57 |
By :
leksoft |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณครับ เด่วลองดูก่อนครับ
|
 |
 |
 |
 |
Date :
2013-03-12 10:34:00 |
By :
leksoft |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|