Results 1 to 13 of 13

Thread: Help with ListBox error [resolved]

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    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.
    Last edited by nkad; Jan 7th, 2005 at 03:44 PM.

  2. #2
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: Help with ListBox error

    i know this is probably a stupid question but are then items in the list?

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: Help with ListBox error

    no, but it still gives the same error even when i try to just add items to the list.

  4. #4
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: Help with ListBox error

    can you post the code?

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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

  6. #6
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,963

    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?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

  7. #7

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: Help with ListBox error

    Correct. I can not add items to the ListBox. When I try to, I get this error

    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.

  8. #8
    Frenzied Member vbdotnetboy's Avatar
    Join Date
    Jun 2004
    Location
    Lewisburg, PA "Next year Raiders in the Super Bowl"
    Posts
    1,310

    Re: Help with ListBox error

    can you add anything at all even a string?

    Derek - Using VS 2008 99% of the time and VS 2003 1% of the time

    Please Help Us To Save Ana

    ● Helpful Links: DNR TV | Awesome site for tips | Using ADO.NET to work with Excel | Xml Namespace 2.0 Framework Changes|Ultra High Security Password Generator | Mendhak's ADO.NET Tutorial
    ● Code Bank: Random Password Generator | Generic DbProviderFactory Access
    ● Site Work: Bottle Run Xtreme | Spaids Racing.com

    Company I work for - CSSI

    WHEN POSTING PLEASE INDICATE VERSION

    Please use vbcode tags or code tags when posting code
    [highlight=vb]ALL your code goes here[/highlight] or [code]ALL your code goes here[/code]

    If my post helped you in anyway... please be kind and give me some ratings

  9. #9
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: Help with ListBox error

    try a rebuild all.. perhaps its using an old cache of the compiled exe

  10. #10

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: Help with ListBox error

    Rebuilt entire project.... no luck

    ListBox1.Items.Add("fun")

    doesnt work.

  11. #11
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    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

  12. #12

    Thread Starter
    Fanatic Member
    Join Date
    Sep 2000
    Posts
    770

    Re: Help with ListBox error

    wow... creating a new projected worked.... go figure.

    thanks!

  13. #13
    PowerPoster
    Join Date
    Dec 2003
    Location
    Bristol, England (but heart is in Virginia)
    Posts
    2,963

    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?
    Taxes
    The more I learn about VB.NET the more I like dBaseIII Plus

    The foregoing, whilst believed to be correct, is given without guarantee as to it's accuracy and entirely without recourse. You are required to decide for yourself whether or not it is suitable for your purposes and no liability for loss of any nature can be entertained.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width