Question FOrm Wont Load After Copying Solutions

paulthepaddy

Well-known member
Joined
Apr 9, 2011
Messages
222
Location
UK
Programming Experience
Beginner
Hey guys, im not sure what is going on here,
basicly i had to format my computer, so i needed to reinstall Office 2010 and VS2010, but now my solutions wont load, VS isn't giving much information about it apart form its a object refrence equalls null, but i dont have a clue where to start as it happening before the form load. this is all the information i can give.

An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.

System.InvalidOperationException{"An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."}

i have tried cleaning, rebuilding, build solutions and none is helping, if any1 can think of anything else to try please say, another option would be :
Their is a bit of software call teamviewer that i use, if anyone would be willing to download it and instal it, it would give them the ability to controll my computer to have a look and see what has went wrong.

any help on this matter would be GREATLY Appreciated
 
You say that you don;t have a clue where to start but you posted exactly where to start yourself:
An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object.

System.InvalidOperationException{"An error occurred creating the form. See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."}
That will tell you EXACTLY where the original exception was thrown, i.e. what line of what file. It will be somewhere in the InitializeComponent method of your form in the designer code file. To see the designer code file in the Solution Explorer you must first click the Show All Files button and then expand the node for the form.
 
ok thank's i figured out where the error is BUT i don't see why the error is happening, the only object that is used has been declaired in the form class as

Dim Carselect As BindingList(Of car) = New BindingList(Of car)

VB.NET:
Private Sub discount(selectcar As car)
        'If Me.CheckBox_Discount.Checked = True Then
        'lbl_Dis_add.Text = "Discount"
        'Call selectcar.Calculate_SubTotal()
        'selectcar.Discount = SSR_add_Minus.Value
        'selectcar.Total = selectcar.Subtotal - selectcar.Discount
        'Car_Price_Total.Value = selectcar.Total
        'End If

        'If Me.CheckBox_Discount.Checked = False Then
        'Me.CheckBox_Discount.Text = "Additonal Cost"
        'lbl_Dis_add.Text = "Additonal Cost"
        'Call selectcar.Calculate_SubTotal()
        'selectcar.additional = SSR_add_Minus.Value
        'selectcar.Subtotal += selectcar.additional
        'selectcar.Total = selectcar.Subtotal
        'Car_Price_Total.Value = selectcar.Total
        'End If
    End Sub

the form does load if this sub is commented out, the binding list is bound to 3 diffrent combobox's so i dont understand why the object is null.

P.S i didn't realise the box that poped up expanded into more detail, all it was saying was

See Exception.InnerException for details. The error is: Object reference not set to an instance of an object."}

thanks for your help, im sure i will figure out what has went wrong here, also the calculation sub is a bit messy so it give em a good reason to recreate it lol
 
Where is that method called? You're still not looking at the information the IDE is trying to give you. The stack trace of the exception tells you exactly where the exception is thrown and what methods were called to get to that line. The most likely explanation is that you are handling an event and, in the event handler, making use of data that doesn't actually exist while the form is being created. You need to determine what that data is and only use it if it exists. All the information is provided for you when the exception is thrown.
 
Back
Top