0

Suppose you have a registration form with textboxes to hold a StudentId and a CourseId. Also provided is a button which opens a second form which allows you to lookup a StudentId using by their first or last name.

How return the StudentId from the search form, and load it into the StudentId textbox on the registration form?

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
odiseh
  • 25,407
  • 33
  • 108
  • 151

1 Answers1

1

I think this answer explains the solution nicely.

Basically, you create a new constructor for your search form which takes a form object as a parameter. When you create call your search form, you pass a reference to the registration form with it.

When the search form finds the studentId, it uses this reference to the registration form to call a public method in the registration form which populates the studentId textbox.

Community
  • 1
  • 1
AgentConundrum
  • 20,288
  • 6
  • 64
  • 99