Reputation: 65
I am writing a program to calculate payrolls for employees. What I need to know is how to get payroll information from variables from one form to another.
The form I need the variable data from is called Timesheet and the form I need the data for is called PayRoll.
When I use the following code:
lblName.Text = TimeSheet.EmpName
I get the error that EmpName is not a member of EmployeeInfo.Timesheet (the project file the Timesheet is located) after I generated a class for it.
Any ideas to link these forms?
Upvotes: 0
Views: 1686
Reputation: 647
Shouldn't be anything wrong with that as long as you are calling the TimeSheet form from the PayRoll form and as long as you have instanciated and retained an instance of that form.
I would expect to see something like:
Dim ts as New TimeSheet
ts.ShowDialog()
' Do whatever you need in the timesheet form to set it.
lblName.Text = ts.EmpName
One thing to note is if you call the Dispose() method you will loose your property.
More information on your problem might be more helpful if this does not answer your question.
Upvotes: 1