Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7726003
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T05:06:04+00:00 2026-06-01T05:06:04+00:00

i keep running in this issue where it will jump out of the for

  • 0

i keep running in this issue where it will jump out of the for statements that generate the table, I’ve been pouring over the code for a better part of three hours and i cannot find what is going wrong so i think i need another pair of eyes.


Shared Function DrawGrid() As TableLayoutPanel
Dim dayNames As New ArrayList
dayNames.Add(“Monday”)
dayNames.Add(“Tuesday”)
dayNames.Add(“Wednesday”)
dayNames.Add(“Thursday”)
dayNames.Add(“Friday”)
dayNames.Add(“Saturday”)
dayNames.Add(“Sunday”)
Dim hour As Integer = 8
Dim minute As Integer = 0
Dim timeType As String = “AM”
Dim dayLength As Integer = 12
Dim timetable As New TableLayoutPanel
timetable.CellBorderStyle = TableLayoutPanelCellBorderStyle.Inset

'Loops through days one at a time this creates the labels and adds them for reference by the user but is not needed for the timetable creation
For days As Integer = 0 To 7
    timetable.ColumnCount += 1
    timetable.RowCount += 1
    If days > 0 Then
        Dim NamePos As New TableLayoutPanelCellPosition(days, 0)
        Dim lblDay As New Label

        lblDay.Text = CStr(dayNames.Item(days))

        timetable.SetCellPosition(lblDay, NamePos)
        timetable.Controls.Add(lblDay)
    End If

    For time As Integer = 0 To dayLength
        Dim rowPos As New TableLayoutPanelCellPosition(days, time)
        Dim lblTime As New Label
        Dim timeString As String
        timetable.RowCount += 1
        If days = 0 Then
            minute += 6
            If minute = 6 Then
                minute = 0
                hour += 1

            End If
            If hour = 13 Then
                hour = 1
                timeType = "PM"
            End If
            timeString = "Time is " & hour & ":" & minute & "0 " & timeType
            lblTime.Text = timeString

            timetable.SetCellPosition(lblTime, rowPos)

            timetable.Controls.Add(lblTime)
            timetable.Visible = True

        End If


    Next
Next
timetable.GrowStyle = TableLayoutPanelGrowStyle.AddColumns
timetable.AutoSize = True
MessageBox.Show("Working")
Return timetable

End Function

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T05:06:06+00:00Added an answer on June 1, 2026 at 5:06 am

    Are you able to add a breakpoint to the For loop to see at what point error is being generated? If so check what the local variable values are just before it throws the exception.

    An out of range exception can be because you are trying to access an array/collection item that doesn’t exist.

    For instance myArray(4) has 5 items, if I try to access myArray(5) I will get an out of range exception, because the index starts at 0.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How would I implement a system that will keep 20 applications running on a
I know this has been asked before (and I will keep researching), but I
This is a design issue I keep running into, so I thought I would
I keep running into this design problem, and I'm not happy with my solution
I keep running into this error MemCacheError (Broken pipe): Broken pipe on my Rails
I keep running in to this awful OAuth Verification Failure, it seems to not
I am sure this is relatively simple, I just keep running into brick walls.
I'm writing this query and I'm running into a mental road block. I keep
I keep running into the same testing Failure, and I can't figure out quite
I will do my best to lay this out in text. Essentially, we have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.