CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 1 of 1
  1. #1
    Join Date
    Feb 2009
    Posts
    35

    [RESOLVED] VB net 2022 Checkbox generates catch

    I have a dlg which loads pre-set information for controls on the dlg within the "Load" routine. Everything worked at one time, but now the checkbox's all throw a catch. The message is:

    Code:
    Error occured for the following reason [Index was outside the bounds of the array.]
    I am performing a direct input to the checkbox, so there is no array involved.

    Code:
                CK_AUTO_CLOSE_MAIN.Checked = True
                CK_AUTO_ASSIGN_MAIN.Checked = True
                CK_AUTO_RELAUNCH_MAIN.Checked = False
                CK_USE_CHECKLIST.Checked = False
                CK_AUTO_GEN_CHECKLIST.Checked = False
                CK_AUTO_CREATE_PER_FOLDER.Checked = False
                CK_AUTO_LAUNCH_PI.Checked = False
                CK_AUTO_LOAD_PI_LIST.Checked = False
                CK_AUTO_LAUNCH_RISK.Checked = False
                CK_AUTO_OPEN_ATTACHMENTS.Checked = False
                CK_AUTO_COMPARE_CHECKLIST.Checked = False
                CK_AUTO_COMPARE_CHECKLIST.Checked = False
                CK_AUTO_RUN.Checked = False
    With the catch being thrown, the remaining controls do not get initialized. When I comment out the checkboxes, everything else initializes as expected. I have gone through the properties to see if perhaps there is something there, but I did not see anything out of the ordinary.

    Any ideas on where to start?

    EDIT: I do pass 2 setting/option arrays to the dlg box, not sure if the way I'm doing it may be causing the issue.

    Code:
        Private Sub BTN_OPTIONS_Click(sender As Object, e As EventArgs) Handles BTN_OPTIONS.Click
            Dim oOptions As New DLG_OPTIONS
    
            'Load the arrays for the option dlg
            oOptions.SetOptionArray(GetOptionArray)
            oOptions.SetSettingsArray(GetSettingsArray)
    
    
            oOptions.ShowDialog() 'vbModeless
    
            If (oOptions.DialogResult = DialogResult.OK) Then
                'Restore our main arrays with any changes made
                SetOptionArray(oOptions.GetOptionArray())
                SetSettingsArray(oOptions.GetSettingsArray())
            End If
    
        End Sub
    EDIT2: I commented out everything but the load in the dlg and the checkbox's worked. Guess I need to see what in the file is causing this. Thanks for your time in reading this.
    Last edited by 2kaud; June 23rd, 2025 at 03:29 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured