i have a database at mysql and i already save image and use search button to retrieve image from mysql database to picture box, vb.net , i dont have a code how listview retrieve all image from mysql but the code is different funtion but the concet is the same.
'this code is retrieve all the image from file locatioin
Private Sub open_image_from_file_location_Load(sender As Object, e As EventArgs) Handles MyBase.Load
ListView1.Items.Clear()
'retrieve image from specific folder
Dim dirFiles() As String = IO.Directory.GetFiles("D:\Perity Files\Komasan")
Dim _imgList As New ImageList
Dim imgSize As New Size
'setting up custom size
imgSize.Width = 100
imgSize.Height = 50
ListView1.LargeImageList = _imgList
ListView1.LargeImageList.ColorDepth = ColorDepth.Depth32Bit
Dim count As Integer = 0
Dim item As New ListViewItem
For Each dirFile As String In dirFiles
Dim imgFilename As String = IO.Path.GetFileNameWithoutExtension(dirFile)
Dim img As New System.Drawing.Bitmap(dirFile)
Dim imgImage As Image = Image.FromFile(dirFile)
_imgList.ImageSize = imgSize
_imgList.Images.Add(img.Clone)
ListView1.Items.Add(imgFilename, count)
count += 1
Next
End Sub
'this one is retrieve image from database using datagridviewer
Private Sub load_data()
Try
cn = New MySqlConnection
cn.ConnectionString = "data source=localhost; user id=root; database=account;"
cn.Open()
constr = "SELECT ID,NAME,EMAIL,IMG FROM users;"
cmd = New MySqlCommand(constr, cn)
da = New MySqlDataAdapter
dt = New DataTable
da.SelectCommand = cmd
da.Fill(dt)
cn.Close()
DataGridView1.DataSource = dt
Catch ex As MySqlException
MsgBox(ex.Message)
Finally
cn.Close()
da.Dispose()
End Try
End Sub
but i looking for how listview retrieve image from mysql database