title: VB.NET: What is the best way to retrieve a value from a second form?
body: <p>I'm teaching myself VB.Net.</p>
  
  <p>Here is a problem I have recently come across. Say I have a main Form1 in my application. Form1 calls a second LoginForm which (like the name suggests) is a login window with username/password type fields. Expected behaviour is that LoginForm will capture login details and pass them back to Form1.</p>
  
  <p>What is the best way to do this?</p>
  
  <p>In my mind, I was thinking along the lines of a function call like 'doLogin' that would 'show' the LoginForm, capture the data entered, dispose of the form and return the login details (probably in some kind of bean). Somehow I don't see this as being possible</p>
  
  <p>What I have currently is less elegant. LoginForm is shown by Form1 modally (i.e. showDialog); a 'me' reference is passed to the second window. After user input has been received on LoginForm, I set a value on Form1, then dispose. </p>
  
  <p>Is this the way everybody does it?</p>