When running my VB.Net code (below), I get the following error:
An unhandled exception of type ‘System.InvalidOperationException’
occurred in CropModel.exe An error occurred creating the form. See
Exception.InnerException for details. The error is: Object reference
not set to an instance of an object.
Private Class Frm_Main
Private Sub Form_MainControl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Reinsurance_YearTableAdapter.Fill(Me.CUNACropModelDataSet.Reinsurance_Year)
Me.Ref_CropTableAdapter.Fill(Me.CUNACropModelDataSet.ref_Crop)
Me.MdiParent = MDIParent1
End Sub
Private Sub Button_ModelLoss_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_ModelLoss.Click
Frm_LossModel_Select.MdiParent = MDIParent1
Frm_LossModel_Select.Show()
Frm_LossModel_Select.Activate()
'Me.Close()
End Sub
End Class
The debug points the issue in the following line:
Frm_LossModel_Select.MdiParent = MDIParent1
Seems this error is very general. Is it possible to know where the actual error is being caused in Frm_LossModel_Select (if it is even being caused there)? The only things changed in that form were DataSet names and table names from SQL and I made sure those were all being referenced properly.
If additional code is needed for this issue, I’d be more than willing to provide.
Thanks!
asked Mar 5, 2015 at 21:25
7
Load 7 more related questions
Show fewer related questions
- Remove From My Forums
-
Вопрос
-
возникла проблема: нужно чтобы при показе первого окна приложения показывалось второе (главное событие — Form1.Shown).
вот код:
Public Sub form2Show() Handles Me.Shown
Form2.Show()
End Sub
но при попытке его исполнения мне пишет:
Form2.Show()
Ошибка при создании формы. См. Exception.InnerException. Ошибка: Ссылка на объект не указывает на экземпляр объекта.
Как исправить?-
Изменено
8 декабря 2011 г. 23:32
-
Перемещено
Abolmasov Dmitry
27 января 2012 г. 11:29
(От:Работа в среде Visual Studio)
-
Изменено
Ответы
-
> Ошибка при создании формы. См. Exception.InnerException. Ошибка: Ссылка на объект не указывает на экземпляр объекта.
надо создать экземпляр формы. на C# так:var frm = new Form2(); frm.Show();
-
Изменено
Malobukv
9 декабря 2011 г. 5:44 -
Помечено в качестве ответа
Abolmasov Dmitry
20 декабря 2011 г. 12:36
-
Изменено
When running my VB.Net code (below), I get the following error:
An unhandled exception of type ‘System.InvalidOperationException’
occurred in CropModel.exe An error occurred creating the form. See
Exception.InnerException for details. The error is: Object reference
not set to an instance of an object.
Private Class Frm_Main
Private Sub Form_MainControl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Reinsurance_YearTableAdapter.Fill(Me.CUNACropModelDataSet.Reinsurance_Year)
Me.Ref_CropTableAdapter.Fill(Me.CUNACropModelDataSet.ref_Crop)
Me.MdiParent = MDIParent1
End Sub
Private Sub Button_ModelLoss_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_ModelLoss.Click
Frm_LossModel_Select.MdiParent = MDIParent1
Frm_LossModel_Select.Show()
Frm_LossModel_Select.Activate()
'Me.Close()
End Sub
End Class
The debug points the issue in the following line:
Frm_LossModel_Select.MdiParent = MDIParent1
Seems this error is very general. Is it possible to know where the actual error is being caused in Frm_LossModel_Select (if it is even being caused there)? The only things changed in that form were DataSet names and table names from SQL and I made sure those were all being referenced properly.
If additional code is needed for this issue, I’d be more than willing to provide.
Thanks!
When running my VB.Net code (below), I get the following error:
An unhandled exception of type ‘System.InvalidOperationException’
occurred in CropModel.exe An error occurred creating the form. See
Exception.InnerException for details. The error is: Object reference
not set to an instance of an object.
Private Class Frm_Main
Private Sub Form_MainControl_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Me.Reinsurance_YearTableAdapter.Fill(Me.CUNACropModelDataSet.Reinsurance_Year)
Me.Ref_CropTableAdapter.Fill(Me.CUNACropModelDataSet.ref_Crop)
Me.MdiParent = MDIParent1
End Sub
Private Sub Button_ModelLoss_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button_ModelLoss.Click
Frm_LossModel_Select.MdiParent = MDIParent1
Frm_LossModel_Select.Show()
Frm_LossModel_Select.Activate()
'Me.Close()
End Sub
End Class
The debug points the issue in the following line:
Frm_LossModel_Select.MdiParent = MDIParent1
Seems this error is very general. Is it possible to know where the actual error is being caused in Frm_LossModel_Select (if it is even being caused there)? The only things changed in that form were DataSet names and table names from SQL and I made sure those were all being referenced properly.
If additional code is needed for this issue, I’d be more than willing to provide.
Thanks!
Помогите пожалуйста разобраться с такой проблемой:
Написал программу на VB2005, грубо выглядит так — стартует форма, на ней кнопка, жмем кнопку, открывается еще одна форма, на ней WebBrowser и AxMCIWnd.
На исходном компьютере, все запускается замечательно, error list чист, без предупреждений.
Пытаюсь запустить на другом (пробовал на нескольких) — пишет необрабатываемое исключение, и форму не грузит.
в окне ошибки вот что:
Подробная информация об использовании оперативной
(JIT) отладки вместо данного диалогового
окна содержится в конце этого сообщения.
************** Текст исключения **************
System.InvalidOperationException: Ошибка при создании формы. См. Exception.InnerException. Ошибка: Сбой при запросе. —> System.Security.SecurityException: Сбой при запросе.
в System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Assembly asm, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
в System.Security.CodeAccessSecurityEngine.ThrowSecurityException(Object assemblyOrString, PermissionSet granted, PermissionSet refused, RuntimeMethodHandle rmh, SecurityAction action, Object demand, IPermission permThatFailed)
в System.Security.CodeAccessSecurityEngine.CheckSetHelper(PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Object assemblyOrString, SecurityAction action, Boolean throwException)
в System.Security.CodeAccessSecurityEngine.CheckSetHelper(CompressedStack cs, PermissionSet grants, PermissionSet refused, PermissionSet demands, RuntimeMethodHandle rmh, Assembly asm, SecurityAction action)
в WindowsApplication1.Form1.InitializeComponent()
в WindowsApplication1.Form1..ctor()
Ошибкой завершилось следующее действие:
LinkDemand
Ошибкой завершилось первое разрешение следующего типа:
System.Security.PermissionSet
Ошибкой завершилась сборка со следующим параметром Zone:
Intranet
— Конец трассировки внутреннего стека исключений —
в WindowsApplication1.My.MyProject.MyForms.Create__Instance__[T](T Instance)
в WindowsApplication1.My.MyProject.MyForms.get_Form1()
в WindowsApplication1.main.Button1_Click(Object sender, EventArgs e)
в System.Windows.Forms.Control.OnClick(EventArgs e)
в System.Windows.Forms.Button.OnClick(EventArgs e)
в System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
в System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
в System.Windows.Forms.Control.WndProc(Message& m)
в System.Windows.Forms.ButtonBase.WndProc(Message& m)
в System.Windows.Forms.Button.WndProc(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
в System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Загруженные сборки **************
mscorlib
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.235 (QFE.050727-2300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
—————————————-
Diplom
Версия сборки: 1.0.0.0
Версия Win32: 1.0.0.0
CodeBase: file:///Z:/Resourses/Материалы%20по%20учебе/Прога/vb2005/Diplom/bin/Debug/Diplom.exe
—————————————-
Microsoft.VisualBasic
Версия сборки: 8.0.0.0
Версия Win32: 8.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic/8.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
—————————————-
System
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.235 (QFE.050727-2300)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll
—————————————-
System.Windows.Forms
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
—————————————-
System.Drawing
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
—————————————-
mscorlib.resources
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.235 (QFE.050727-2300)
CodeBase: file:///C:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll
—————————————-
System.Runtime.Remoting
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Runtime.Remoting/2.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
—————————————-
System.Configuration
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll
—————————————-
System.Xml
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll
—————————————-
Microsoft.VisualBasic.resources
Версия сборки: 8.0.0.0
Версия Win32: 8.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/Microsoft.VisualBasic.resources/8.0.0.0_ru_b03f5f7f11d50a3a/Microsoft.VisualBasic.resources.dll
—————————————-
System.Windows.Forms.resources
Версия сборки: 2.0.0.0
Версия Win32: 2.0.50727.42 (RTM.050727-4200)
CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms.resources/2.0.0.0_ru_b77a5c561934e089/System.Windows.Forms.resources.dll
—————————————-
Пробовал создать publish — no же самое.
поясню — первая форма запускается, а при попытке запустить вторую — вылазит ошибка
Уважаемые гуру, в чем может быть дело?
может необрабатываемое исключение нужно как то обрабатывать?
1605 / 1337 / 291 Регистрация: 25.10.2009 Сообщений: 3,487 Записей в блоге: 2 |
|
1 |
|
Ошибка при создании формы25.07.2010, 14:12. Показов 2722. Ответов 2
День добрый. Появилась проблема. Писал проект , всё было нормально, всё работало. Additional information: Ошибка при создании формы. См. Exception.InnerException. Ошибка: Значение не может быть неопределенным.
0 |
Евгений М. 1080 / 1007 / 106 Регистрация: 28.02.2010 Сообщений: 2,889 |
||||
25.07.2010, 14:27 |
2 |
|||
Попробуйте.
Должно быть перед UserFrom.Show() или UserForm.Visible = True
0 |
1605 / 1337 / 291 Регистрация: 25.10.2009 Сообщений: 3,487 Записей в блоге: 2 |
|
25.07.2010, 14:42 [ТС] |
3 |
Спасибо но нет. В Visual Studio 2008 не используется Load/Unload Добавлено через 12 минут
0 |
Hi guys,
I have an error when creating my form, and this is what it says. I have no idea what to do. Could someone help?
Thanks,
iProgramIt
The error:
System.InvalidOperationException was unhandled HResult=-2146233079 Message=An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object. Source=Coders Digi-Book StackTrace: at Coders_Digi_Book.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190 at Coders_Digi_Book.My.MyProject.MyForms.get_Form1() at Coders_Digi_Book.My.MyApplication.OnCreateMainForm() in C:\Users\mac0017\Documents\Visual Studio 2013\Projects\Coders Digi-Book\Coders Digi-Book\My Project\Application.Designer.vb:line 35 at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at Coders_Digi_Book.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException: System.NullReferenceException HResult=-2147467261 Message=Object reference not set to an instance of an object. Source=Coders Digi-Book StackTrace: at Coders_Digi_Book.Form1.FastColoredTextBox1_TextChanged(Object sender, TextChangedEventArgs e) in C:\Users\mac0017\Documents\Visual Studio 2013\Projects\Coders Digi-Book\Coders Digi-Book\Form1.vb:line 157 at System.EventHandler`1.Invoke(Object sender, TEventArgs e) at FastColoredTextBoxNS.FastColoredTextBox.OnTextChanged(TextChangedEventArgs args) at FastColoredTextBoxNS.FastColoredTextBox.OnTextChanged() at FastColoredTextBoxNS.FastColoredTextBox.System.ComponentModel.ISupportInitialize.EndInit() at Coders_Digi_Book.Form1.InitializeComponent() in C:\Users\mac0017\Documents\Visual Studio 2013\Projects\Coders Digi-Book\Coders Digi-Book\Form1.Designer.vb:line 360 at Coders_Digi_Book.Form1..ctor() in C:\Users\mac0017\Documents\Visual Studio 2013\Projects\Coders Digi-Book\Coders Digi-Book\Form1.vb:line 28 InnerException:
The Form’s code:
Imports System.ComponentModel Public Class Form1 Private Const WM_NCLBUTTONDOWN As Long = &HA1 Private Const WM_NCLBUTTONUP As Long = &HA0 Private Const WM_MOVING As Long = &H216 Private Const WM_SIZE As Long = &H5 Protected Overrides Sub DefWndProc(ByRef m As System.Windows.Forms.Message) Static LButtonDown As Boolean If CLng(m.Msg) = WM_NCLBUTTONDOWN Then LButtonDown = True ElseIf CLng(m.Msg) = WM_NCLBUTTONUP Then LButtonDown = False End If If LButtonDown Then If CLng(m.Msg) = WM_MOVING Then If Me.Opacity <> 0.9 Then Me.Opacity = 0.5 ElseIf CLng(m.Msg) = WM_SIZE Then If Me.Opacity <> 0.6 Then Me.Opacity = 0.6 End If ElseIf Not LButtonDown Then If Me.Opacity <> 1.0 Then Me.Opacity = 1.0 End If MyBase.DefWndProc(m) End Sub Public SnippetsFolder As String = Application.StartupPath & "\Snippets\" Public RelativeFolder As Boolean = IO.File.ReadAllLines(Application.StartupPath & "\Settings.cdbs")(0) Public AutoSave As Boolean = IO.File.ReadAllLines(Application.StartupPath & "\Settings.cdbs")(2) Private Sub MenuItem3_Click(sender As Object, e As EventArgs) Handles MenuItem3.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.CSharp End Sub Private Sub MenuItem4_Click(sender As Object, e As EventArgs) Handles MenuItem4.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.VB End Sub Private Sub MenuItem5_Click(sender As Object, e As EventArgs) Handles MenuItem5.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.HTML End Sub Private Sub MenuItem6_Click(sender As Object, e As EventArgs) Handles MenuItem6.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.XML End Sub Private Sub MenuItem7_Click(sender As Object, e As EventArgs) Handles MenuItem7.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.SQL End Sub Private Sub MenuItem8_Click(sender As Object, e As EventArgs) Handles MenuItem8.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.PHP End Sub Private Sub MenuItem9_Click(sender As Object, e As EventArgs) Handles MenuItem9.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.JS End Sub Private Sub MenuItem10_Click(sender As Object, e As EventArgs) Handles MenuItem10.Click FastColoredTextBox1.Language = FastColoredTextBoxNS.Language.Lua End Sub Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load If Me.IsInitializing = True Then Exit Sub Else End If Dim lsc As New launchScreenControl Me.Controls.Add(lsc) lsc.Dock = DockStyle.Fill lsc.BringToFront() If RelativeFolder = False Then SnippetsFolder = IO.File.ReadAllLines(Application.StartupPath & "\Settings.cdbs")(1) & "\" Else : SnippetsFolder = Application.StartupPath & "\Snippets\" End If RebuildSnippetList() End Sub Private Sub MenuItem11_Click(sender As Object, e As EventArgs) Handles MenuItem11.Click NewSnippet() End Sub Sub NewSnippet() IO.File.WriteAllText(SnippetsFolder & InputBox("Please name the snippet:") & ".cdbf", "") RebuildSnippetList() End Sub Sub RebuildSnippetList() Dim MyImages As New ImageList() MyImages.ColorDepth = ColorDepth.Depth32Bit MyImages.ImageSize = New Size(16, 16) MyImages.Images.Add("Folder", My.Resources.winvista_ico_shell32_dll_003) MyImages.Images.Add("Item", My.Resources.winvista_ico_shell32_dll_071) TreeView1.ImageList = MyImages TreeView1.Nodes.Clear() If IO.Directory.Exists(SnippetsFolder) = False Then IO.Directory.CreateDirectory(SnippetsFolder) Dim i As Integer = 0 For Each Folder As String In IO.Directory.GetDirectories(SnippetsFolder) TreeView1.Nodes.Add("Folder", My.Computer.FileSystem.GetName(Folder)) For Each File As String In IO.Directory.GetFiles(Folder, "*.cdbf") Dim specFile As String = My.Computer.FileSystem.GetName(File) Dim specIndex As Integer = specFile.LastIndexOf(".") TreeView1.Nodes(i).Nodes.Add("Item", specFile.Remove(specIndex), 1, 1) Next i += 1 Next End Sub Private Sub MenuItem17_Click(sender As Object, e As EventArgs) Handles MenuItem17.Click Me.Close() End Sub Private Sub NewToolStripButton_Click(sender As Object, e As EventArgs) Handles NewToolStripButton.Click NewSnippet() End Sub Private Sub CutToolStripButton_Click(sender As Object, e As EventArgs) Handles CutToolStripButton.Click FastColoredTextBox1.Cut() End Sub Private Sub CopyToolStripButton_Click(sender As Object, e As EventArgs) Handles CopyToolStripButton.Click FastColoredTextBox1.Copy() End Sub Private Sub PasteToolStripButton_Click(sender As Object, e As EventArgs) Handles PasteToolStripButton.Click FastColoredTextBox1.Paste() End Sub Sub SingleImport() Dim ofd As New OpenFileDialog ofd.Filter = "Coders' Digi-Book Files (*.cdbf)|*.cdbf" ofd.Title = "Import Snippet.." If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then If IO.Directory.Exists(SnippetsFolder & "\Imported\") = False Then IO.Directory.CreateDirectory(SnippetsFolder & "\Imported\") IO.File.Copy(ofd.FileName, SnippetsFolder & "\Imported\" & My.Computer.FileSystem.GetName(ofd.FileName)) RebuildSnippetList() End If End Sub Private Sub OpenToolStripButton_Click(sender As Object, e As EventArgs) Handles OpenToolStripButton.Click SingleImport() End Sub Private Sub MenuItem12_Click(sender As Object, e As EventArgs) Handles MenuItem12.Click SingleImport() End Sub Sub SingleExport() If TreeView1.SelectedNode.SelectedImageIndex = 1 Then Dim sfd As New SaveFileDialog sfd.Filter = "Coders' Digi-Book Files (*.cdbf)|*.cdbf" sfd.Title = "Export Snippet.." If sfd.ShowDialog = Windows.Forms.DialogResult.OK Then IO.File.Copy(SnippetsFolder & "\" & TreeView1.SelectedNode.Parent.Text & "\" & TreeView1.SelectedNode.Text & ".cdbf", sfd.FileName) End If End If End Sub Private Sub MenuItem14_Click(sender As Object, e As EventArgs) Handles MenuItem14.Click SingleExport() End Sub Private Sub SaveToolStripButton_Click(sender As Object, e As EventArgs) Handles SaveToolStripButton.Click If TreeView1.SelectedNode.SelectedImageIndex = 1 Then IO.File.WriteAllText(SnippetsFolder & "\" & TreeView1.SelectedNode.Parent.Text & "\" & TreeView1.SelectedNode.Text & ".cdbf", FastColoredTextBox1.Text) End If End Sub Private Sub ListBox1_SelectedIndexChanged(sender As Object, e As EventArgs) Handles ListBox1.SelectedIndexChanged FastColoredTextBox1.Text = IO.File.ReadAllText(SnippetsFolder & ListBox1.SelectedItem & ".cdbf") End Sub Private Sub FastColoredTextBox1_TextChanged(sender As Object, e As FastColoredTextBoxNS.TextChangedEventArgs) Handles FastColoredTextBox1.TextChanged If TreeView1.SelectedNode.ImageIndex = 1 Then If AutoSave Then IO.File.WriteAllText(SnippetsFolder & "\" & TreeView1.SelectedNode.Parent.Text & "\" & TreeView1.SelectedNode.Text & ".cdbf", FastColoredTextBox1.Text) End If End Sub Private Sub MenuItem20_Click(sender As Object, e As EventArgs) Handles MenuItem20.Click RebuildSnippetList() End Sub Private Sub HelpToolStripButton_Click(sender As Object, e As EventArgs) Handles HelpToolStripButton.Click Dim frm As New Settings If frm.ShowDialog = Windows.Forms.DialogResult.OK Then Dim lbl As New Label lbl.Text = "Changes have been made to settings. Click this text to restart." lbl.AutoSize = False lbl.Font = New Font("Arial", 12) lbl.Dock = DockStyle.Fill AddHandler (lbl.Click), AddressOf ClickTheLabel Me.Controls.Add(lbl) lbl.BringToFront() ToolStrip1.Enabled = False For Each mnuItem As MenuItem In MainMenu1.MenuItems mnuItem.Enabled = False Next End If End Sub Sub ClickTheLabel(sender As Object, e As EventArgs) Application.Restart() End Sub Private Sub Form1_Resize(sender As Object, e As EventArgs) Handles Me.Resize End Sub Private Sub MenuItem13_Click(sender As Object, e As EventArgs) Handles MenuItem13.Click Dim FOLDERDG As New FolderBrowserDialog FOLDERDG.ShowNewFolderButton = False FOLDERDG.Description = "Please select a folder to retrieve the snippets from." If FOLDERDG.ShowDialog = Windows.Forms.DialogResult.OK Then For Each file As String In IO.Directory.GetFiles(FOLDERDG.SelectedPath, "*.cdbf") IO.File.Copy(file, SnippetsFolder & "\Imported\" & My.Computer.FileSystem.GetName(file)) Next End If RebuildSnippetList() End Sub Private Sub MenuItem21_Click(sender As Object, e As EventArgs) Handles MenuItem21.Click Dim FOLDERDG As New FolderBrowserDialog FOLDERDG.ShowNewFolderButton = False FOLDERDG.Description = "Please select a folder to copy the snippets to." If FOLDERDG.ShowDialog = Windows.Forms.DialogResult.OK Then For Each file As String In IO.Directory.GetFiles(SnippetsFolder, "*.cdbf") IO.File.Copy(file, FOLDERDG.SelectedPath & My.Computer.FileSystem.GetName(file)) Next End If End Sub Private Sub MenuItem23_Click(sender As Object, e As EventArgs) Handles MenuItem23.Click Dim cde As New codingEnvironment cde.Show() End Sub Private Sub TreeView1_AfterSelect(sender As Object, e As TreeViewEventArgs) Handles TreeView1.AfterSelect If TreeView1.SelectedNode.SelectedImageIndex = 1 Then FastColoredTextBox1.Enabled = True FastColoredTextBox1.Text = IO.File.ReadAllText(SnippetsFolder & "\" & e.Node.Parent.Text & "\" & e.Node.Text & ".cdbf") Else FastColoredTextBox1.Enabled = False FastColoredTextBox1.Text = "" End If End Sub Private Sub FastColoredTextBox1_Load(sender As Object, e As EventArgs) Handles FastColoredTextBox1.Load End Sub End Class