Help with ListBox error [resolved]
This is the error i get when trying to do FolderList.Items.Clear() or anything else dealing with the list box that i added to my form.
An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication1.exe
Additional information: Object reference not set to an instance of an object.
Re: Help with ListBox error
i know this is probably a stupid question but are then items in the list?
Re: Help with ListBox error
no, but it still gives the same error even when i try to just add items to the list.
Re: Help with ListBox error
Re: Help with ListBox error
try deleting and readding FolderList to your form (please note this will require that you "rewire" any events for FolderList that were being handled in code)
it sounds like at some point the name got changed or something and it was not reflected in the collapsed for designer code
Re: Help with ListBox error
Quote:
Originally Posted by nkad
no, but it still gives the same error even when i try to just add items to the list.
That is not clear. Do you mean that you can't add items to the list?
Re: Help with ListBox error
Correct. I can not add items to the ListBox. When I try to, I get this error
Quote:
An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication1.exe
Additional information: Object reference not set to an instance of an object.
I have tried deleting the control and re-adding it and using the default name of the control; ListBox1.
I still get the same error.
Re: Help with ListBox error
can you add anything at all even a string?
Re: Help with ListBox error
try a rebuild all.. perhaps its using an old cache of the compiled exe
Re: Help with ListBox error
Rebuilt entire project.... no luck
ListBox1.Items.Add("fun")
doesnt work.
Re: Help with ListBox error
try creating a new project and adding a listbox and trying to add an item... if that fails as well then perhaps something is screwy with your install and it may require a reinstallation... otherwise at least it has to do just with that project
Re: Help with ListBox error
wow... creating a new projected worked.... go figure.
thanks!
Re: Help with ListBox error
A few questions.
Did you create the Listbox in code or in design mode?
Are you getting the error at design time or run time?
If at runtime, does any previous part of the program run?