Please confirm if the variables used logoPath will contain the complete path of the image and pctLogo is an Image type variable.
Please confirm[/QUOTE]

logoPath is the complete path to the image.
pctLogo is a control of the type System.Windows.Forms.PictureBox, but the image-property is of the same type for every control. I think the code would also work if pctLogo would be a CommandButton ;)


This code should do it:

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.Runtime.InteropServices

Namespace ExtractIcon
Partial Public Class Form1
Inherits Form
' Constants that we need in the function call
Private Const SHGFI_ICON As Integer = &H100
Private Const SHGFI_SMALLICON As Integer = &H1
Private Const SHGFI_LARGEICON As Integer = &H0

    ' This structure will contain information about the file
    Public Structure SHFILEINFO
        ' Handle to the icon representing the file
        Public hIcon As IntPtr
        ' Index of the icon within the image list
        Public iIcon As Integer
        ' Various attributes of the file
        Public dwAttributes As UInteger
        ' Path to the file
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=256)> _
        Public szDisplayName As String
        ' File type
        <MarshalAs(UnmanagedType.ByValTStr, SizeConst:=80)> _
        Public szTypeName As String
    End Structure
    ' The signature of SHGetFileInfo (located in Shell32.dll)

    <DllImport("Shell32.dll")> _
    Public Shared Function SHGetFileInfo(ByVal pszPath As String, ByVal dwFileAttributes As UInteger, ByRef psfi As SHFILEINFO, ByVal cbFileInfo As Integer, ByVal uFlags As UInteger) As IntPtr
    End Function

    Public Sub New()
    End Sub

    Private Sub btnExtract_Click(ByVal sender As Object, ByVal e As EventArgs)
        ' Will store a handle to the small icon
        Dim hImgSmall As IntPtr
        ' Will store a handle to the large icon
        Dim hImgLarge As IntPtr
        Dim shinfo As New SHFILEINFO()
        ' Open the file that we wish to extract the icon from
        If openFile.ShowDialog() = DialogResult.OK Then
            ' Store the file name
            Dim FileName As String = openFile.FileName
            ' Store the icon in this myIcon ...

The contents of the zipfile is placed in the targetfolder. You can use DirectoryInfo.GetFiles() to process each file in the targetdir and extract them afterwards if you want.

Another option would be to use the FastZip(FastZipEvents) to create the new instance so you get notified of each individual file that is being unpacked. When you unpack another zipfile, you can respond to that on the spot.

Sorry I cannot give you any code. I don't have the lib installed.


It looks like you start using the reader without reading some data first.

void ReadData(SqlConnection conn, string sql)
SqlDataReader datareader;
SqlCommand cmd = new SqlCommand();
cmd.Connection = conn;
cmd.CommandText = sql;
datareader = cmd.ExecuteReader();
while (datareader.Read()) {
// perform your code here



The VB shell-command returns an ID that you can use to activate the specified application.
Dim MyAppID as Long

Sub StartApplication()
MyAppID = Shell("C:\Notepad.exe", 1)
End Sub

Sub MySendkeys(String Keystring, Optional Boolean Wait=False)
If (MyAppID <> 0) Then
Call AppActivate(MyAppID)
Call SendKeys(Keystring, Wait)
End If
End Sub
This should do the trick.