here's me full code, i dont get why all the exceptions just after i hit f5 to debug, doesn't state errors, it's all valid code......
and here's the exceptions:
Code:
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Imports System.IO
Public Class SelectPrograms
'App Name : Post Install
'Author : Chris Reynolds (Chris2k)
'Creation Date : 26th March 2013
'
'To do:
' Add a settings form.........
' Improve the editor..........
' Add update ability..........
' Add icons to app list.......
' Fix install order n force install ability....
' Add logfile..........................
Public Shared Ver As String = " - Version 1.0.1 Beta 2"
Public Shared programs As Dictionary(Of Integer, program) = New Dictionary(Of Integer, program)
Dim autoStart As Integer = 41
'//Hotkeys
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vkey As Long) As Integer
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Hotkey_StopAutoStart As Boolean = GetAsyncKeyState(Keys.P)
Dim Hotkey_ShowEditor As Boolean = GetAsyncKeyState(Keys.F1)
If Hotkey_StopAutoStart = True Then
CheckBox2.Checked = True
Seconds_Remain.Enabled = False
CheckBox2.Enabled = False
End If
If Hotkey_ShowEditor = True Then 'Show the editor "F1"
Editor.Show()
CheckBox2.Checked = True
Seconds_Remain.Enabled = False
CheckBox2.Enabled = False
End If
End Sub
Private Sub SelectPrograms_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Text = "Post Install By Chris2k" + Ver
Dim iniFile As String = Application.StartupPath + "\Start\InstallCFG.ini"
If Not (System.IO.File.Exists(iniFile)) Then
MessageBox.Show("The programs opted for this OS can't be installed as the InstallCFG.ini has not been included...")
End If
Dim highestIO As Integer = 1
Dim installOrder As Integer = 0
For Each ln In IO.File.ReadAllLines(iniFile)
Try
If ln.ToLower.StartsWith("install order") Then
installOrder = (ln.IndexOf(":"c) + 1)
programs.Add(installOrder, New program)
ElseIf ln.ToLower.StartsWith("app name") Then
programs(installOrder).name = (ln.Substring(ln.IndexOf(":"c) + 1))
ElseIf ln.ToLower.StartsWith("description") Then
programs(installOrder).desc = (ln.Substring(ln.IndexOf(":"c) + 1))
'//ElseIf ln.ToLower.StartsWith("app file size") Then
'//programs(installOrder).filesize = getFileSize(program.exepath) (ln.Substring(ln.IndexOf(":"c) + 1))
ElseIf ln.ToLower.StartsWith("app file") Then
programs(installOrder).exepath = (ln.Substring(ln.IndexOf(":"c) + 1))
programs(installOrder).exeicon = getIcon(programs(installOrder).exepath)
End If
Catch ex As Exception
End Try
Next
If (programs.Count > 0) Then
'CheckBox1.Checked = True
End If
Dim cOrder As Integer = 0
Do While (cOrder < (highestIO + 1))
Try
If Not programs.ContainsKey(cOrder) Then
'TODO: Warning!!! continue If
End If
Dim program As program = programs(cOrder)
If Not (program) Is Nothing AndAlso program.name.Length > 0 Then
If IO.File.Exists(program.exepath) Then
imageList1.Images.Add(program.name, program.exeicon.ToBitmap)
Dim pLI As ListViewItem = New ListViewItem(program.name, program.name)
pLI.SubItems.Add(program.desc)
pLI.SubItems.Add(getFileSize(program.exepath))
pLI.SubItems.Add(program.exepath)
pLI.Checked = True
App_List.Items.Add(pLI)
Else
'"Installer file for program '" + (program.name + "' could not be found!"
End If
Else
'"Failed to load program from order: " + (cOrder + "..!"
End If
cOrder = (cOrder + 1)
Catch ex As Exception
End Try
Loop
Seconds_Remain.Start()
End Sub
Public Function getFileSize(ByVal path As String) As String
Dim sizes() As String = New String() {"B", "KB", "MB", "GB"}
Dim len = My.Computer.FileSystem.GetFileInfo(path).Length
Dim order As Integer = 0
While ((len >= 1024) _
AndAlso (order + (1 < sizes.Length)))
order = (order + 1)
len = (len / 1024)
End While
Return String.Format("{0:0.##} {1}", len, sizes(order))
End Function
Private Sub CheckBox2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox2.CheckedChanged
If CheckBox2.Checked = True Then
Seconds_Remain.Enabled = False
CheckBox2.Enabled = False
End If
End Sub
Public Function getIcon(ByVal path As String) As Icon
Try
Return Icon.ExtractAssociatedIcon(path)
Catch ex As System.Exception
Return Nothing
End Try
End Function
Private Sub CheckBox1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
If CheckBox1.Checked Then
For Each CheckedApp As ListViewItem In App_List.Items
CheckedApp.Checked = True
Next
Else
For Each CheckedApp As ListViewItem In App_List.Items
CheckedApp.Checked = False
Next
End If
Button1.Text = "Start installing (" + App_List.CheckedItems.Count.ToString + " apps.)"
End Sub
Private Sub Seconds_Remain_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Seconds_Remain.Tick
If autoStart > 0 Then
autoStart -= 1
CheckBox2.Text = "Stop ticking (" + autoStart.ToString & " Secs Remaining!)"
ElseIf autoStart = 0 Then
CheckBox2.Enabled = False
Label2.Text = "We're gonna install now..."
InstallPrograms.Show()
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If App_List.CheckedItems.Count > 0 Then
Me.Hide()
InstallPrograms.Show() '//Load in the form and install checked apps.
Else
MessageBox.Show("Nothing selected to install!")
End If
End Sub
Private Sub App_List_ItemChecked(ByVal sender As Object, ByVal e As System.Windows.Forms.ItemCheckedEventArgs) Handles App_List.ItemChecked
Button1.Text = "Start installing (" + App_List.CheckedItems.Count.ToString + " apps.)"
End Sub
End Class
Public Class program
Public order As Integer = 0
Public name As String = ""
Public desc As String = ""
Public exepath As String = ""
Public filesize As Integer
Public install As Boolean = True
Public exeicon As Icon = Nothing
Public Sub New()
MyBase.New()
End Sub
End Class
Code:
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
A first chance exception of type 'System.Collections.Generic.KeyNotFoundException' occurred in mscorlib.dll
+ more......