PDA

View Full Version : load imagefrom db



sahele_sheni
جمعه 30 مرداد 1388, 21:10 عصر
سلام.چرا من نمیتونم عکس هام رو از db لود کنم !؟!؟؟!



Dim ms As IO.MemoryStream = New IO.MemoryStream()
moblimg.Image.Save(ms, moblimg.Image.RawFormat)
Dim picarray As Byte() = ms.GetBuffer()
ms.Close()





Dim fs As IO.FileStream

fs = New IO.FileStream(adressimg.Text, FileMode.Open, FileAccess.Read, FileShare.Read)

Dim myData(fs.Length) As Byte

از یکی از این دو روش برای ذخیره عکس استفاده میکنم


Dim img As Byte() = CType(Me.MoblDataSet1.tbl_kala.Rows(1).Item("ax"), Byte())
Dim str As New MemoryStream
str.Write(img, 0, img.Length)
Dim bit As New Bitmap(str)
picturebox1.image = bit



Dim arrpic() As Byte
arrpic = CType(Me.MoblDataSet1.tbl_kala.Rows(1).Item("ax"), Byte()) '


Dim ms As New System.IO.MemoryStream(arrpic)
Dim bmp As New Bitmap(ms)

PictureBox1.Image = bmp

و از این دو راه هم واسه لود کردن عکس ها
ولی زمانی که میخواد علس رو توی picturebox نشون بده اشکال میگیره....
از خط آخر این error رو میگیره ::the parameter is not valid