0

Hi there everyone, I have this program due for 10h00 tomorrow and iv been sitting here for 2 hours, stuck because I cant get past that error when I type in the information for the last loop, if anyone could point me in the right Direction I will be greatly obliged :)

Kind Regards

Option Strict On
Option Explicit On
Public Class frmHospital

    Private Structure InternType
        Public NameIntern As String
        Public SatisfactionValue() As Integer
        Public Total As Integer
    End Structure

    Private Structure MedicalTeamType
        Public NameHeadSurgeon As String
        Public Interns() As InternType
    End Structure

    Private MedicalTeams(,) As MedicalTeamType

    Private TotalPerTeam() As Integer

    Private nDays As Integer
    Private nMedicalTs As Integer
    Private nInterns As Integer
    Private nPatients As Integer

    Private Sub Place_Labels(ByVal r As Integer, ByVal c As Integer, ByVal t As String)
        grdMedical.Row = r
        grdMedical.Col = c
        grdMedical.Text = t
    End Sub

    Private Sub cmdClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdClose.Click
        Application.Exit()
    End Sub

    Private Sub frmHospital_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

    End Sub

    Private Sub cmdInit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdInit.Click

        nDays = CInt(InputBox("Enter Number of Days:"))
        nMedicalTs = CInt(InputBox("Enter The Number of Medical Teams:"))
        nInterns = CInt(InputBox("Enter The Number of Interns Per Medical Team:"))
        nPatients = CInt(InputBox("Enter The Number of Patients Per Team:"))

        grdMedical.Rows = nDays + 2
        grdMedical.Cols = nMedicalTs + 1

        For i = 1 To nDays
            Place_Labels(i, 0, "Day " & i)
        Next i

        For j = 1 To nMedicalTs
            grdMedical.set_ColWidth(j, 100)
            Place_Labels(0, j, "Medical Team " & j)
        Next j

        Place_Labels(nDays + 1, 0, "Average")


    End Sub

    Private Sub cmdRead_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdRead.Click
        Dim i, j, k, l As Integer

        'Resizing the arrays and the arrays inside the record structure
        ReDim TotalPerTeam(nMedicalTs)
        ReDim MedicalTeams(nDays, nMedicalTs)

        For i = 1 To nDays
            For j = 1 To nMedicalTs
                For k = 1 To nInterns
                    ReDim MedicalTeams(i, j).Interns(nInterns)
                    For l = 1 To nPatients
                        ReDim MedicalTeams(i, j).Interns(k).SatisfactionValue(nPatients)
                    Next l
                Next k
            Next j
        Next i

        'asking the user for the correct input and storing the values in the correct places
        For i = 1 To nDays
            For j = 1 To nMedicalTs
                MedicalTeams(i, j).NameHeadSurgeon = InputBox("Day " & i & ", Name of Specialist Surgeon For Medical Team " & j)
                For k = 1 To nInterns
                    MedicalTeams(i, j).Interns(k).NameIntern = InputBox("Enter The Name Of Intern " & k & ", In Medical Team " & j)
                    For l = 1 To nPatients
                        MedicalTeams(i, j).Interns(k).SatisfactionValue(l) = CInt(InputBox("Enter the Satisfaction Value for Patient " & l))
                    Next l
                Next k
            Next j
        Next i

    End Sub
End Class

Edited by Curt1337: n/a

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by asaukani
0

the best way if u cud use debugger which can determine which line cause an error, i am still online and will try to help u

ahmad

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.