Link to home
Create AccountLog in
Avatar of Matrix1000
Matrix1000

asked on

List MDI Child forms in a listview and BringToFront() when listview item is clicked?

I have a MDIParent form with a listview docked left, and MDI child forms. I want to list all the mdi children in the listview by their title text and when I click on an item I want the associated child to BringToFront().

How would I do that (code example please)

I suck at this so this is what I invented so far but its not even close to working.
'when a new mdi child is created it adds the title of the form to the listview :
ListView1.Items.Add(Me.ActiveMdiChild.Text)
 
'when the listview item is clicked it brings the mdi child to the front.
 
        Dim JumpToWindow As String = ListView1.Items.Item(ListView1.SelectedItems.ToString())
 
        Me.ActivateMdiChild(JumpToWindow.BringToFront())

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of jandromeda
jandromeda
Flag of Sri Lanka image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of Matrix1000
Matrix1000

ASKER

For some reason I cant get that to work.
Are you getting any error? or it is not selecting the expected form? If it is the second issue then try hard coding the child form text and see. If this works then something wrong with getting the selected ListViewItem.
It doesn't like "Form[] children "
Are trying the code I gave you in VB.NET? If so I am soo sorry. The code I gave you is C#.
Yah, I tried to convert it with C# to VB converter but it won't convert... thanks though:)