Drag and Drop Explorer : ListView « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » ListViewScreenshots 
Drag and Drop Explorer
  
Imports System.Windows.Forms

Public Class Form1
    Inherits System.Windows.Forms.Form

    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub

    Friend WithEvents ListView1 As System.Windows.Forms.ListView
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents ImageList1 As System.Windows.Forms.ImageList
    Friend WithEvents Filename As System.Windows.Forms.ColumnHeader
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Dim resources As System.Resources.ResourceManager = New System.Resources.ResourceManager(GetType(Form1))
        Me.ListView1 = New System.Windows.Forms.ListView()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.ImageList1 = New System.Windows.Forms.ImageList()
        Me.Filename = New System.Windows.Forms.ColumnHeader()
        Me.SuspendLayout()
        '
        'ListView1
        '
        Me.ListView1.AllowDrop = True
        Me.ListView1.Columns.AddRange(New System.Windows.Forms.ColumnHeader() {Me.Filename})
        Me.ListView1.Location = New System.Drawing.Point(1632)
        Me.ListView1.Name = "ListView1"
        Me.ListView1.Size = New System.Drawing.Size(368296)
        Me.ListView1.SmallImageList = Me.ImageList1
        Me.ListView1.TabIndex = 0
        Me.ListView1.View = System.Windows.Forms.View.Details
        '
        Me.Label1.Location = New System.Drawing.Point(168)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(36016)
        Me.Label1.TabIndex = 1
        Me.Label1.Text = "Drag and drop files from Explorer onto this ListView control:"
        '
        Me.ImageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth8Bit
        Me.ImageList1.ImageSize = New System.Drawing.Size(1616)
        Me.ImageList1.ImageStream = CType(resources.GetObject("ImageList1.ImageStream"), System.Windows.Forms.ImageListStreamer)
        Me.ImageList1.TransparentColor = System.Drawing.Color.Transparent
        '
        Me.Filename.Text = "File / folder"
        Me.Filename.Width = 300
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(400342)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label1, Me.ListView1})
        Me.Name = "Form1"
        Me.Text = "Drag and Drop from Windows Explorer"
        Me.ResumeLayout(False)

    End Sub

    Private Sub ListView1_DragOver(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgsHandles ListView1.DragOver
        If e.Data.GetDataPresent(DataFormats.FileDropThen
            e.Effect = DragDropEffects.Copy
        End If
    End Sub

    Private Sub ListView1_DragDrop(ByVal sender As Object, ByVal e As System.Windows.Forms.DragEventArgsHandles ListView1.DragDrop
        If (e.Data.GetDataPresent(DataFormats.FileDrop)) Then
            Dim strFiles() As String = e.Data.GetData(DataFormats.FileDrop)
            Dim intCount As Integer
            For intCount = To strFiles.Length
                ListView1.Items.Add(strFiles(intCount)0)
            Next
        End If
    End Sub
End Class

   
    
  
Related examples in the same category
1.ListView Custom sortListView Custom sort
2.Build ListView at run time: update title column textBuild ListView at run time: update title column text
3.Construct ListView at run time: build structure and insert recordsConstruct ListView at run time: build structure and insert records
4.Fill XML data into ListView and add column to ListView at run timeFill XML data into ListView and add column to ListView at run time
5.Large Icon and small Icon for ListView
6.Add Customized Item to ListViewAdd Customized Item to ListView
7.Add Selection Listener to the ListViewAdd Selection Listener to the ListView
8.Add Items to ListViewAdd Items to ListView
9.Displaying directories and their contents in ListViewDisplaying directories and their contents in ListView
10.Set ListView header and fill dataSet ListView header and fill data
11.ListView DataReader
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.