Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Conversion from string to type 'Boolean' is not valid.  (Read 5964 times)

0 Members and 1 Guest are viewing this topic.

youngbucks

    Topic Starter


    Rookie

    Conversion from string to type 'Boolean' is not valid.
    « on: June 18, 2008, 07:22:37 AM »
    Im creating an uninstaller and i keep getting the following error "Conversion from string "C:\Pointblanc\Game" to type 'Boolean' is not valid." Any idea on whats gone wrong, here my script:
    Code: [Select]
    Imports System.IO

    Public Class FrmUninstall
        Private Const m_cUNINSTALLDIRECTORY As String = "c:\Pointblanc"
        Private Sub FrmUninstall_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
            Dim intFileCount As Integer
            Dim intFolderCount As Integer
            Dim intFileCounter As Integer
            Dim intFolderCounter As Integer

            Me.Show()
            Me.Refresh()

            With My.Computer.FileSystem

                'Delete Files
                intFileCount = .GetFiles(m_cUNINSTALLDIRECTORY).Count
                intFolderCount = .GetDirectories(m_cUNINSTALLDIRECTORY).Count
                ProgressBar1.Maximum = intFolderCount + intFileCount

                If intFolderCount > 0 Then

                    intFolderCounter = 1

                    For Each Folder As String In .GetDirectories(m_cUNINSTALLDIRECTORY)
                        Dim FolderFoundInfo As New System.IO.DirectoryInfo(Folder)
                        InstallLog("Removing folder " & FolderFoundInfo.Name & " (" & intFolderCounter.ToString & " of " & intFolderCount.ToString & ")")
                        Directory.Delete(Folder, m_cUNINSTALLDIRECTORY & "\" & FolderFoundInfo.Name)
                        ProgressBar1.Value = ProgressBar1.Value + 1
                        lblPercent.Text = CStr(Fix(100 * intFolderCounter / intFolderCount)) & "%"
                        intFolderCounter = intFolderCounter + 1
                    Next
                Else
                    MsgBox("There seems to be a foler(s) missing, Please reinstall.")
                End If

                If intFileCount > 0 Then

                    intFileCounter = 1

                    For Each FileFound As String In .GetFiles(m_cUNINSTALLDIRECTORY)
                        Dim FileFoundInfo As New System.IO.FileInfo(FileFound)
                        InstallLog("Removing file " & FileFoundInfo.Name & " (" & intFileCounter.ToString & " of " & intFileCount.ToString & ")")
                        .DeleteFile(m_cUNINSTALLDIRECTORY & "\" & FileFoundInfo.Name)
                        ProgressBar1.Value = ProgressBar1.Value + 1
                        lblPercent.Text = CStr(Fix(100 * intFileCounter / intFileCount)) & "%"
                        intFileCounter = intFileCounter + 1
                    Next
                Else
                    InstallLog("No files to copy.")
                End If
            End With
            MsgBox("Uninstallation Complete")
            Application.Exit()
        End Sub


        Private Sub InstallLog(ByVal strLog As String)
            txtInstallLog.Text = txtInstallLog.Text & strLog & vbCrLf
            txtInstallLog.SelectionStart = txtInstallLog.Text.Length

        End Sub
    End Class

    Dias de verano

    • Guest
    Re: Conversion from string to type 'Boolean' is not valid.
    « Reply #1 on: June 18, 2008, 10:25:25 AM »
    Directory.Delete(Folder, m_cUNINSTALLDIRECTORY & "\" & FolderFoundInfo.Name)

    See here

    http://msdn.microsoft.com/en-us/library/fxeahc5f.aspx