Click here to Skip to main content
15,891,746 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to expand my listview, when some one double click on the main form title bar, at mean time the list view which is also situated on main form becomes larger as the main window expands.
while i am using this code for desired action.

What I have tried:

Private Sub MDIPar1_DoubleClick(sender As Object, e As EventArgs) Handles Me.DoubleClick
       ListView1.Dock = DockStyle.Fill
   End Sub
Posted
Updated 7-Jan-17 2:01am
v2
Comments
OriginalGriff 7-Jan-17 7:53am    
And?
The problem is?
Saadbinata 7-Jan-17 7:55am    
it doesn't expands with double click on the title bar. means the window expands and the list view doesn't expands.

1 solution

Try using Control.Resize Event (System.Windows.Forms)[^] event to react on all size changes. Just investigate the Form.WindowState Property (System.Windows.Forms)[^] to see if the window is maximized or not.
 
Share this answer
 
Comments
Saadbinata 7-Jan-17 8:29am    
it will but one more problem arises. it will expands in starts and i need when i double click on the title bar then it will expands and it also fetch the records. do you get my point Dear Sir.


Private Sub MDIPar1_Resize(sender As Object, e As EventArgs) Handles Me.Resize
ListView1.Dock = DockStyle.Fill

End Sub
Wendelius 7-Jan-17 8:31am    
I'm not sure if I fully understand but if you need to fetch data at the same time, simply write the code for fetching after setting the dockstyle.
Saadbinata 7-Jan-17 8:38am    
i have a group box at the top of list view when program is loaded the screen is in add record mode and it shows all required textboxes and other controls, but if the user need to look the full screen form it simply double click on the title bar and the list view control expands also and show all data which is in data base. do you get my point.
Wendelius 7-Jan-17 8:52am    
I'm not sure if I understand but when the window is maximized you can modify the controls as you like in the resize event. If you need to make modifications to the layout or to the content of the controls or anything else, simply add proper code.

I can't help you much further since I don't have the layout or the requirements. However, if you have specific problems, I suggest posting the relevant code parts along with a new question.
Saadbinata 7-Jan-17 8:59am    
Thanks for your support. i will provide the details on Monday morning.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900