title: Input textbox data into array of objects
body: <p>I am using the module to declare the public class patient across all forms of my program. What do I have to do in order to input data into the array from three text boxes. One for Names, Heights, and Weights. Thanks </p>
  
  <pre><code>Public Module Module1
  Public PatientCount As Integer = 0
  
  Public Class Patient
  
      Public Property Name As String = String.Empty
  
      Public Property Height As Decimal = 0
  
      Public Property Weight As Decimal = 0
  
  End Class
  End Module
  
  
  Dim patients As List(Of Patient) = New List(Of Patient)
  </code></pre>
  
  <p>For displaying patients in listbox</p>
  
  <pre><code>    For Each p As Module1.Patient In Patients
          lstPatients.Items.Add(p.Name)
      Next
  </code></pre>
  
  <p>CURRENT CODE:
  MODULE</p>
  
  <pre><code>Public Module Module1
  Public PatientCount As Integer = 0
  Public Patients As List(Of Patient) = New List(Of Patient)
  
  Public Class Patient
  
      Public Property Name As String
  
      Public Property Height As Decimal
  
      Public Property Weight As Decimal
  
      Public Sub New(ByVal name As String, ByVal height As Decimal, ByVal weight As Decimal)
          name = _Name
          weight = _Weight
          height = _Height
      End Sub
  End Class
  End Module
  </code></pre>
  
  <p>FORM 2 (Entry of Data)</p>
  
  <pre><code>Public Class Form2
  
  
  Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnMainMenu.Click
      Me.Close()
  End Sub
  
  Private Sub btnEnterPatient_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterPatient.Click
  
      patients.Add(New Patient(txtName.Text, CDec(txtHeight.Text), CDec(txtWeight.Text)))
  
      PatientCount = PatientCount + 1
      Label1.Text = PatientCount
  
  End Sub
  End Class
  </code></pre>
  
  <p>FORM 3 (Listing of Data)
      Public Class Form3</p>
  
  <pre><code>Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  
      For Each p As Patient In Patients
          lstPatients.Items.Add("Name: " &amp; p.Name)
          lstPatients.Items.Add("Weight: " &amp; p.Weight)
          lstPatients.Items.Add("Height: " &amp; p.Height)
          lstPatients.Items.Add("___________")
      Next
  
  End Sub
  End Class
  </code></pre>