Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27350

argumentoutofrangexception was unhandled by user code

$
0
0
I get this error message when the form loads.
Because of this code

Code:

    Public Sub AssignJobData()
        Dim count As Integer = 1
        For i = 1 To JobTitles.Count - 1
            If EmployeeForm.JobDropBox.Text = JobTitles(i) Then
                EmployeeForm.HourlyRateBox.Text = "£" & HourlyRates(count)
                EmployeeForm.JobDescriptionBox.Text = JobDescriptions(count)
            End If
            count += 1
        Next

    End Sub

Code:

    Private Sub JobDropBox_TextUpdate(ByVal sender As Object, ByVal e As System.EventArgs) Handles JobDropBox.TextUpdate
        AssignJobData()
    End Sub

and this data loads when the form loads


Code:

        JobTitles.Add("")
        JobTitles.Add("Chief Executive")
        JobTitles.Add("Manager")
        JobTitles.Add("Electrician")
        JobTitles.Add("Human Resources")
        JobTitles.Add("Secretary")
        JobTitles.Add("Administrion (Assistant)")
        JobTitles.Add("Administration (Manager)")
        EmployeeForm.JobDropBox.DataSource = JobTitles

        HourlyRates.Add(0)
        HourlyRates.Add(18)
        HourlyRates.Add(13)
        HourlyRates.Add(11)
        HourlyRates.Add(9)
        HourlyRates.Add(9)
        HourlyRates.Add(8)
        HourlyRates.Add(10)

        JobDescriptions.Add("..")
        JobDescriptions.Add("Responsible for the management of staff and administrative tasks. Reports to the Board of Trustees regarding the organisation's mission and strategic plan.")
        JobDescriptions.Add("Manages a brand of the company. Reports to Regional Managers regarding the running of the branch. Deals with local onsite decisions.")
        JobDescriptions.Add("Works solely in the field. Reports back to Managers and administration staff to complete paperwork.")
        JobDescriptions.Add("Develop, advise on and implement policies relating to the effective use of personnel within an organisation. Also to ensure that the organisation employs the right balance of staff in terms of skills and experience.")
        JobDescriptions.Add("Works closely with the manager and senior members of staff to help maintain smooth running of the company. In charge of organising events for both the company and manager.")
        JobDescriptions.Add("Performs basic paperwork tasks including Employee Profiles, Invoicing and updating the Client Database.")
        JobDescriptions.Add("Oversees the work performed by Administrative Assistants. Manages recruitment and ensures work in completed in time and to the correct standard.")

I swear it's not out of range because it's zero-based and between zero and the number of list items - 1.
I'm totally stumped.

Anyone?

Viewing all articles
Browse latest Browse all 27350

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>