I'm having trouble tracking down what is wrong and causing the above error. This only occurs when saving the design view in VS 2012. The code builds and runs fine.
Full error text:
Code generation for property 'CompanyValue' failed. Error was: 'Property accessor 'CompanyValue' on object 'ContactViewUC1' threw the following exception: 'Object variable or With block variable not set."
CompanyValue definition in ContactViewUC:
Public Property CompanyValue
LeadsViewBindingSource.Filter = "CompanyID = " & value
And the only place it is referenced from:
Private Sub LeadsViewBindingSource_Positionchanged(sender As Object, e As System.EventArgs) Handles LeadsViewBindingSource.Positionchanged
If Not LeadsViewBindingSource.Count = 0 Then
ContactViewUC1.CompanyValue = LeadsViewBindingSource.Current("CompanyID")
CompanyDetailUC1.CompanyValue = LeadsViewBindingSource.Current("CompanyID")
Yes, I get the same error on the other user control.
This is just a designer problem, but it's a real pain when I try to save the project. Note that if I have not opened the parent window in VS2010, I do not get he error. Even if I open the code for the window, make changes, and then save I do not get the error. The error occurs anytime I open the degin view for the form and then try and save without making any changes.
I would appreciate any clues as to what is going on.
View the full article