Hello, I have what I believe is a simple problem, but due to my inexperience with classes, I'm not sure exactly what is going on.
What happens is, I created a read-only property called GetFullName and the code is as followed:
Partial Public Class PurchaseOrder
Public ReadOnly Property GetEmpFullName
Get
Dim EmpFullName As String = Employee.FirstName & " " & Employee.LastName
Return EmpFullName
End Get
End Property
End Class
Its a partial class for employees. And if it matters, I'm using Entity Framework for handling data.
On my form I have a combo box that display the employees full name and I use the class for the display member, while its ID is the value member which is used for saving into other tables.
However whenever I close my form I get an error and it jumps straight to my partial class and highlights my GetFullName code.
So my question is, does anyone know exactly why I'm getting an error and what I can do to fix my problem? Thanks for reading this and much thanks for any and all help.
Note: The class works fine and "Employee" is pointing to the employee table in the ADO.NET Entity Data Model. The problem only occurs when the form closes.
Update:
My combo box is pointing to the employee's partial class GetFullName property, but the purchase order's GetFullName property is the one where the error is coming from. I've done a lot of thinking and I think its just the way I put my classes together.
Am I able to create a class just for the entities as a whole and then just reference the the tables I need to? That way I won't have duplicate code and multiple classes and this should fix my problem.