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
Get
Return LeadsViewBindingSource.Current("CompanyID")
End Get
Set(value)
LeadsViewBindingSource.Filter = "CompanyID = " & value
End Set
End Property
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")
End If
End Sub
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




Sign In
Create Account
Back to top







