Listview Save
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
5 posts
Page 1 of 1
Ok, so i am trying to make a "short cut" program...
You right click the Listview on my form and select from context menu "Add file"
I know how to add item with icon and text, and i set "tool tip text" as "filename", and "text" to "safefilename" ...
I add icon to image list too
How can i save all that, and reload it ?
You right click the Listview on my form and select from context menu "Add file"
I know how to add item with icon and text, and i set "tool tip text" as "filename", and "text" to "safefilename" ...
I add icon to image list too
How can i save all that, and reload it ?

U wonna Save all the Items u added in Listview ?!
yes, but i also want to save images from image list, so i can use them too :/
M1z23R wrote:yes, but i also want to save images from image list, so i can use them too :/Please Post your Code here how do u load Images etc.
After that i can make Code for you to Save Items from Listview.
Code: Select all
On Error Resume Next
Dim hImgSmall As IntPtr
Dim hImgLarge As IntPtr
Dim shinfo As SHFILEINFO
shinfo = New SHFILEINFO()
Dim opn As OpenFileDialog
opn = New OpenFileDialog()
opn.InitialDirectory = "c:\temp\"
opn.Filter = "All files (*.*)|*.*"
opn.FilterIndex = 2
opn.RestoreDirectory = True
ListView1.SmallImageList = ImageList1
ListView1.LargeImageList = ImageList1
shinfo.szDisplayName = New String(Chr(0), 260)
shinfo.szTypeName = New String(Chr(0), 80)
If (opn.ShowDialog() = DialogResult.OK) Then
hImgLarge = SHGetFileInfo(opn.FileName, 0, shinfo, Marshal.SizeOf(shinfo), _
SHGFI_ICON Or SHGFI_LARGEICON)
Dim myIcon As System.Drawing.Icon
myIcon = System.Drawing.Icon.FromHandle(shinfo.hIcon)
ImageList1.Images.Add(myIcon) 'Add icon to imageList.
Dim lvitm As New ListViewItem
lvitm.Text = opn.SafeFileName
lvitm.ToolTipText = opn.FileName
ListView1.Items.Add(lvitm)
lvitm.ImageIndex = ImageList1.Images.Count - 1
End If
5 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023