title: Error caused when calling to a function within a structure
body: <p>I have been stuck on this problem with no solution found on the web. I have tried to change a few things around to no avail.</p>
  
  <p>My problem is that I can't seem to call a function within a structure in VB.
  My structure looks as follows:</p>
  
  <pre><code>Private Structure patient
          Public givenName As String
          Public assignedDoctors() As String
          Public doctorCount As Integer
          Public infected As Boolean
          Private pID As Double
          'Simple status subprocedure
          Public Sub ChangeStatus(ByVal status As String)
              Select Case status
                  Case "positive"
                      infected = True
                      givenName = "{" &amp; givenName &amp; "}"
                  Case "tested"
                      infected = False
                      givenName = $"[{givenName}]"
                  Case "negative"
                      infected = False
                      givenName = $"&lt;{givenName}&gt;"
                  Case "untested"
                      infected = False
                      givenName = $"*{givenName}"
              End Select
          End Sub
  
          Public Sub AddDoctor(ByRef doctor As String)
              doctorCount += 1
              ReDim Preserve assignedDoctors(doctorCount)
              assignedDoctors(doctorCount) = doctor
          End Sub
  
      End Structure
  </code></pre>
  
  <p>My error occurs on the following line:</p>
  
  <pre><code>Private Sub btnNew_Click(sender As Object, e As EventArgs) Handles btnNew.Click
          Dim rPatient As patient
          rPatient = New patient
          rPatient.givenName = txtPatientName.Text
          rPatient.doctorCount = 1
          rPatient.assignedDoctors(1) = cbDoctor.Text
          Call rPatient.ChangeStatus(status:=cbStatus.Text)
          ArrayFix(rPatient.assignedDoctors, rPatient.givenName, rPatient.infected)
      End Sub
  </code></pre>
  
  <p>rPatient is an instance of the structure patient.
  My error occurs on the "Call" line. The error being: <strong>"Object reference not set to an instance of an object."</strong>
  I have tried to make the patient structure "shared" but I do not know how the shared parameter works and have attempted to learn it without progress.</p>
  
  <p>If anyone could point me in the right direction it would be very helpful.
  Thanks.</p>