work with 2 listview

User avatar
sal21
PlatinumLounger
Posts: 4373
Joined: 26 Apr 2010, 17:36

work with 2 listview

Post by sal21 »

I have 2 listview in form... with same dimension and same posiztion in the form.

have 2 command button

i need to show listview1 when click on button1 and show listview when click on button2 hide listview1... eccc

now i use .visible false or true, but "googoling" suugest me to use Zorder, how to?
Tks.

User avatar
HansV
Administrator
Posts: 78631
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: work with 2 listview

Post by HansV »

You can use

controlname.ZOrder 0

to bring a control to the front (in front of all other controls), so in your example, you could use

Code: Select all

Private Sub CommandButton1_Click()
    Me.ListView1.ZOrder 0
End Sub

Private Sub CommandButton2_Click()
    Me.ListView2.ZOrder 0
End Sub
You have to substitute the actual names of your controls.
Best wishes,
Hans

Murat OSMA
NewLounger
Posts: 6
Joined: 04 Mar 2012, 16:40

Re: work with 2 listview

Post by Murat OSMA »

"Control name.ZOrder 0" what does it do?
Www.ExcelVBA.Net - Msn Messenger: muratosma@excelvba.net

User avatar
HansV
Administrator
Posts: 78631
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: work with 2 listview

Post by HansV »

Welcome to Eileen's Lounge!

To place a control, let's say ListView1, in front of all other controls, use

ListView1.ZOrder 0

To place it behind all other controls, use

ListView1.Zorder 1
Best wishes,
Hans

Murat OSMA
NewLounger
Posts: 6
Joined: 04 Mar 2012, 16:40

Re: work with 2 listview

Post by Murat OSMA »

Thank you, Mr. Hans
Oh ok! I understand
Thanks to you, I learned something new. :smile:
Www.ExcelVBA.Net - Msn Messenger: muratosma@excelvba.net