Page 2 of 2 FirstFirst 12
Results 41 to 47 of 47

Thread: [RESOLVED] [Index was outside the bounds of the array.] But it's not

  1. #41

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    323

    Re: [Index was outside the bounds of the array.] But it's not

    Quote Originally Posted by .paul. View Post
    It's the .Net way... It's called Object Oriented Programming...

    https://learn.microsoft.com/en-us/do...ed-programming
    Well aware of OOP from my C/C++ days. I just don't see any way other than this to pass that many items through the constructor.

  2. #42
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,185

    Re: [Index was outside the bounds of the array.] But it's not

    Quote Originally Posted by FunkMonkey View Post
    That is not possible... I pass the Main Form OptionsArr through a SetOptionsArr for the DLG.
    Well pass your OptionsArr through sub new...

    Code:
    Public Sub New(OptionsArr(,) as Object)
        InitializeComponent
        CheckBox1.Checked=OptionsArr 'etc
        ‘ Etc
    End sub

  3. #43

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    323

    Re: [Index was outside the bounds of the array.] But it's not

    Quote Originally Posted by .paul. View Post
    Well pass your OptionsArr through sub new...

    Code:
    Public Sub New(OptionsArr(,) as Object)
        InitializeComponent
        CheckBox1.Checked=OptionsArr 'etc
        ‘ Etc
    End sub
    I'll give that a shot, thanks!

  4. #44
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,185

    Re: [Index was outside the bounds of the array.] But it's not

    I know what you’ve done now, and you should be making progress now.
    We were all barking up the wrong tree for 31 posts because of unnecessary complications. If you’d mentioned the dialog earlier…

  5. #45

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    323

    Re: [Index was outside the bounds of the array.] But it's not

    Quote Originally Posted by .paul. View Post
    I did warn you that my solution would look nothing like your solution. I'm not sure how you're passing and retrieving data to and from your dialog, but it's incorrect... Have a look here. I can't make it any simpler.

    http://www.scproject.biz/Using%20Dialogs.php#bm11
    Actually, it looks Identical to what I have.....

    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
    
    From the link....

    Code:
    Private Sub btnCustomDialog_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCustomDialog.Click
    
        'declare new frmCustomDialog
        Dim frm As New frmCustomDialog
    
        'show the dialog + display the dialog's userText property in a msgbox unless cancelled
        If frm.ShowDialog = DialogResult.OK Then
            MessageBox.Show(frm.userText)
        End If
    
    End Sub

  6. #46

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2025
    Posts
    323

    Re: [Index was outside the bounds of the array.] But it's not

    I have commented out the entire code in the dlg box. The checkbox's do not error at this point. I will backtrack and enable one function at a time till the trouble maker stands out.

    Thanks everyone for your input.

  7. #47
    eXtreme Programmer .paul.'s Avatar
    Join Date
    May 2007
    Location
    Chelmsford UK
    Posts
    26,185

    Re: [RESOLVED] [Index was outside the bounds of the array.] But it's not

    What seems to be your problem now?

Page 2 of 2 FirstFirst 12

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