Getting the Index of a MDI Child Form [Not Solved]
I am writing a MDI program and I need to know how I can get the index of a MDI Child Form. Is there any possible way to do this in VB.NET 2005?
Creating the MDI Child Code:
Dim save As New frmSave
save.txtExt.Text = ".txt"
save.MdiParent = MdiParent
save.Show()
NOTE: The form that this code is coming from is not the MDI Container.
Thank you for your help!
Re: Getting the Index of a MDI Child Form [Not Solved]
MdiParent is the form whose IsMdiContainer property is True. It has an MdiChildren property, which is a Form array. You can use the Array.IndexOf method to find the index of any form in that array.
Re: Getting the Index of a MDI Child Form [Not Solved]
I tried doing that with this code.
vb Code:
With frmMain
Dim frmArr() As Form = .MdiChildren
Dim int As Integer
int = frmArr.IndexOf(frmArr, Me)
End With
It has a green line under frmArr.IndexOf Anyway to get rid of that or did I write the code in the wrong way?
Re: Getting the Index of a MDI Child Form [Not Solved]
Did you read the documentation for the Array.IndexOf method? If you try something and it doesn't work, reading the instructions should be the first thing you do.