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.
5 posts Page 1 of 1
Contributors
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Listview Save
M1z23R
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 ? :D
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

Re: Listview Save
Napster1488
U wonna Save all the Items u added in Listview ?!
YouTube Downloader v3.0
Image
Image
Image
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Listview Save
M1z23R
yes, but i also want to save images from image list, so i can use them too :/
User avatar
Napster1488
VIP - Donator
VIP - Donator
Posts: 524
Joined: Fri Jan 07, 2011 8:41 pm

Re: Listview Save
Napster1488
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.
YouTube Downloader v3.0
Image
Image
Image
User avatar
M1z23R
VIP - Donator
VIP - Donator
Posts: 622
Joined: Tue Sep 28, 2010 4:55 pm

Re: Listview Save
M1z23R
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
Return to “Tutorial Requests”