I am working on a final project for college. I am trying to put the selectedTopping checkboxes into an array so that I can use them in my for statement. I must not be putting the checkboxes into the array right though, because I get the "Object reference not set to an instance of an object." error.
Thanks for your help.
Code:Dim AllCheckboxes As CheckBox() = {selectedTopping0, selectedTopping1, selectedTopping2, selectedTopping3, selectedTopping4, selectedTopping5}Code:For i As Integer = 0 To 5 If (currentSelectedToppings(toppingIndex, i) = "True") Then AllCheckboxes(i).Checked = True Else AllCheckboxes(i).Checked = False End If Next i
Code:System.NullReferenceException was unhandled Message=Object reference not set to an instance of an object. Source=Food_ordering StackTrace: at Food_ordering.pizzaTopping.setCheckBoxes(String topping) in \\gc-ironcase\mydocs\#####\Documents\Visual Studio 2010\Projects\Food_ordering\pizzaTopping.vb:line 56 at Food_ordering.pizzaTopping.displayToppings(String toppingType) in \\gc-ironcase\mydocs\#####\Documents\Visual Studio 2010\Projects\Food_ordering\pizzaTopping.vb:line 20 at Food_ordering.pizzaCustom.loadTopping(String toppingType) in \\gc-ironcase\mydocs\#####\Documents\Visual Studio 2010\Projects\Food_ordering\pizzaCustom.vb:line 13 at Food_ordering.pizzaCustom.vegetablesCheckBox_Click(Object sender, EventArgs e) in \\gc-ironcase\mydocs\#####\Documents\Visual Studio 2010\Projects\Food_ordering\pizzaCustom.vb:line 48 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.CheckBox.OnClick(EventArgs e) at System.Windows.Forms.CheckBox.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.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(IntPtr 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 Food_ordering.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81 at System.AppDomain._nExecuteAssembly(RuntimeAssembly 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, Boolean ignoreSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart() InnerException:


LinkBack URL
About LinkBacks
Reply With Quote


