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 6852529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T01:22:54+00:00 2026-05-27T01:22:54+00:00

really weird behavior in Vb.net 2010 Express. Here is the code: Private Sub Form1_Load(ByVal

  • 0

really weird behavior in Vb.net 2010 Express. Here is the code:

Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim a As Integer
        '... Other lines...'
        Dim di As New IO.DirectoryInfo(App_Path & "midi\")
        Dim diar1 As IO.FileInfo() = di.GetFiles()
        For a = 0 To diar1.Count
            midrep(a) = diar1(a).Name
        Next a
        Preload()
End Sub

For some reason, the last line with “Preload()” instruction is not executed. (I checked with a breakpoint, it never even gets to it).

If I remove the cycle, it works fine. With the cycle, I get no errors or warnings, but the last line is completely ignored. The for cycle is properly executed.

I need the cycle before Preload().

Anyone knows how to solve the issue?

Thanks everyone

  • 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-05-27T01:22:55+00:00Added an answer on May 27, 2026 at 1:22 am

    I’m going to hazard a guess that you’re not getting out of the For loop because you’re exceeding the bounds of either midrep (which you haven’t given us the type of) or diar1, which is clearly an array of FileInfo objects.

    In fact, regardless of midrep‘s definition, you’re definitely exceeding the bounds of diar1, as diar1.Count is always going to be one higher than the last available index. You need to stop looping before you get to diar1.Count.

    For a = 0 To diar1.Count - 1
    '                       ^^^^
        midrep(a) = diar1(a).Name
    Next a
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I`m really confused here about this weird behavior! The thing is, I have a
I have this really weird problem in my code (.Net Framework 3.5). So, in
I'm battling a really weird problem here. I have a Windows 2008 R2 server
I'm experiencing really weird behavior with the Socket.Connect method in C#. I am attempting
We just spent some time chasing down some really weird jQuery/css behavior in IE7/8.
I have a list of links that are exhibiting some really weird behavior. The
All, I am seeing some really weird behavior when I run a query in
This struck me as really weird behaviour and I spent a while checking for
Something really weird is going on with Xcode and an iPhone project I'm working
This is a really weird problem that I have been having. When I download

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.