EDN Admin
Well-known member
Ive seen this question posted a few times but no good results. Im simply loading a dataset from access that happens to have a bitmap stored in a field. I have a listview with a list of CDs by Album/Artist, when I click on one of the CDs I want detailed info to populate below, including a pic box with the stored bitmap. Everything works fine except the pic box. Heres the code I have: <font color="#0000ff" size=2>
Dim</font><font size=2> bytPic() </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>Byte </font><font size=2>
objDataSet = </font><font color="#0000ff" size=2>New</font><font size=2> DataSet
objData.SQL = </font><font color="#800000" size=2>"usp_SelectRecording" </font><font size=2>
objData.InitializeCommand()
objData.AddParameter(</font><font color="#800000" size=2>"@RecordingID"</font><font size=2>, OleDb.OleDbType.Integer, 4, lvwRecordings.SelectedItems.Item(0).Tag)
objData.FillDataSet(objDataSet, </font><font color="#800000" size=2>"Recording"</font><font size=2>)
</font><font size=2>bytPic = </font><font color="#0000ff" size=2>CType</font><font size=2>(objDataSet.Tables(</font><font color="#800000" size=2>"Recording"</font><font size=2>).Rows(0).Item(</font><font color="#800000" size=2>"AlbumCover"</font><font size=2>), </font><font color="#0000ff" size=2>Byte</font><font size=2>())
</font><font color="#0000ff" size=2>Dim</font><font size=2> strPic </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> IO.MemoryStream(bytPic.Length)
strPic.Write(bytPic, 0, bytPic.Length)
picCover.Image = </font><font color="#0000ff" size=2>New</font><font size=2> Bitmap(Image.FromStream(strPic))</font>
<font size=2>I get invalid parameter with this. Anyone have a solid method for doing this. thanks </font>
View the full article
Dim</font><font size=2> bytPic() </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>Byte </font><font size=2>
objDataSet = </font><font color="#0000ff" size=2>New</font><font size=2> DataSet
objData.SQL = </font><font color="#800000" size=2>"usp_SelectRecording" </font><font size=2>
objData.InitializeCommand()
objData.AddParameter(</font><font color="#800000" size=2>"@RecordingID"</font><font size=2>, OleDb.OleDbType.Integer, 4, lvwRecordings.SelectedItems.Item(0).Tag)
objData.FillDataSet(objDataSet, </font><font color="#800000" size=2>"Recording"</font><font size=2>)
</font><font size=2>bytPic = </font><font color="#0000ff" size=2>CType</font><font size=2>(objDataSet.Tables(</font><font color="#800000" size=2>"Recording"</font><font size=2>).Rows(0).Item(</font><font color="#800000" size=2>"AlbumCover"</font><font size=2>), </font><font color="#0000ff" size=2>Byte</font><font size=2>())
</font><font color="#0000ff" size=2>Dim</font><font size=2> strPic </font><font color="#0000ff" size=2>As</font><font size=2> </font><font color="#0000ff" size=2>New</font><font size=2> IO.MemoryStream(bytPic.Length)
strPic.Write(bytPic, 0, bytPic.Length)
picCover.Image = </font><font color="#0000ff" size=2>New</font><font size=2> Bitmap(Image.FromStream(strPic))</font>
<font size=2>I get invalid parameter with this. Anyone have a solid method for doing this. thanks </font>
View the full article