Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 1 of 1
  1. #1
    New to the CF scene
    Join Date
    Sep 2018
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Having trouble with something in Visual Basic ;I

    So, the issue here is this: When I go to delete a listbox item from my settings (My.settings.List.Remove("Item")) Visual Basic just spits this error at me when I try to execute the code:

    "Object reference not set to an instance of an object."

    It's really annoying, I can't seem to find what I'm looking for anywhere else.

    Here's the context:

    Code:
    If cratescombobox.Text <> "" Then
                If cratescombobox.Text = "Loot Crate" Then
                    crates.Text = crates.Text - 1
                    invlist.Items.Remove("Loot Crate x1")
                    cratescombobox.Items.Remove("Loot Crate")
                    cratescombobox.Text = ""
                    invlist.Items.Add("Carrot x1")
                    invlist.Items.Add("Carrot x1")
                    invlist.Items.Add("Carrot x1")
                    invlist.Items.Add("Carrot x1")
                    invlist.Items.Add("Carrot x1")
                    food.Text = food.Text + 5
                    invlist.Items.Add("Iron Dagger")
                    weapons.Text = weapons.Text + 1
                    opencrate.Text = "Opened."
                    If opencrate.Text = "Opened." Then
                        My.Settings.Inventory.Remove("Loot Crate x1")
                    End If
                End If
            End If
    It doesn't give me an error before decompiling, but whenever I press the button that executes this code, It gives me the error :I

    Thanks in advance!

    -w60
    Last edited by vinyl-junkie; Sep 7th, 2018 at 03:26 AM. Reason: added code tags


 

Tags for this Thread

Posting Permissions

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