I have been fixing up code that I wrote years ago before I knew what I was doing. I have mostly just changed syntax for variables and changed many Public functions to Friend.
After completed this maintenance I now get a "object reference not set to instance of an object" error when I try to open a form at the InitializeComponent line of it's New sub. This doesn't happen at start up - only when I click a button to open a different form.
I must have changed something I shouldn't have. I get this error whenever I forget to use the new keyword but I'm not sure how this applies to InitializeComponent().
I copied the Call Stack which I really have never deciphered before so go easy on me please.Thanks in advance.
Code:System.NullReferenceException was unhandled Message=Object reference not set to an instance of an object. Source=DynastyFootball StackTrace: at DynastyFootball.frmPlayDesigner.InitializeComponent() in C:\DynastyFootball\DynastyFootball\frmPlayDesigner.Designer.vb:line 725 at DynastyFootball.frmPlayDesigner..ctor(ClLeague League, UCPlayerCard PlayerCard, frmMainMenu MainMenu, CLPlay Play) in C:\DynastyFootball\DynastyFootball\frmPlayDesigner.vb:line 114 at DynastyFootball.frmMainMenu.DisplayPlayDesignerScreen(CLPlay Play) in C:\DynastyFootball\DynastyFootball\frmMainMenu.vb:line 2729 at DynastyFootball.UCPlaybook.btNewPlay_Click(Object sender, EventArgs e) in C:\DynastyFootball\DynastyFootball\UCPlaybook.vb:line 191 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(ApplicationContext context) at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel() at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine) at DynastyFootball.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args) at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args) at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:




Thanks in advance.
Reply With Quote