|
-
Jul 21st, 2007, 02:03 PM
#1
Thread Starter
Member
how to maximise a datagridview when i maximise my window
Hello everyone
I want to make my datagridview growing when my windows size grows up
i don't know what to do , it really disturbs me , cause i my datagridview size doesn't change when i maximise my window
Thank u
-
Jul 21st, 2007, 02:09 PM
#2
Re: how to maximise a datagridview when i maximise my window
You can either set the Dock property to Fill so it fills the entire form area with the dgv or you can use the Form1_Resize event to code in the appropriate dgv values based upon the current form size.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 21st, 2007, 02:10 PM
#3
Re: how to maximise a datagridview when i maximise my window
Hi there,
You could also try a TableLayoutPanel if you need a little more control over where the grid is: http://msdn2.microsoft.com/en-us/lib...el(vs.80).aspx
Download the 101 VB.NET examples on MSDN as well. There is a full example in there using the TableLayoutPanel to do what you want.
-
Jul 21st, 2007, 02:11 PM
#4
Re: how to maximise a datagridview when i maximise my window
Its not always a good idea to use a tablelayoutpanel as minor resizing like this can be done easily with a line of code vs having to add another control like the tlp.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 21st, 2007, 02:14 PM
#5
Re: how to maximise a datagridview when i maximise my window
 Originally Posted by RobDog888
Its not always a good idea to use a tablelayoutpanel as minor resizing like this can be done easily with a line of code vs having to add another control like the tlp. 
Right. If the grid is the only thing on the form, then the panel is definitely overkill.
-
Jul 21st, 2007, 02:16 PM
#6
Re: how to maximise a datagridview when i maximise my window
But Im assuming that with the way the question is asked, it is perhaps the only control, or maybe there are others but he can handle them, that needs resizing.
Heres and example saadmechiche.
Code:
Private Sub Form1_Resize(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Resize
If Me.WindowState <> FormWindowState.Minimized Then
Me.DataGridView1.Size = New Size(Me.ClientRectangle.Width - 100, Me.ClientRectangle.Height - 100)
End If
End Sub
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 21st, 2007, 02:32 PM
#7
Thread Starter
Member
Re: how to maximise a datagridview when i maximise my window
THANK You all
I have now my answer
see you soon
-
Jul 21st, 2007, 02:38 PM
#8
Re: how to maximise a datagridview when i maximise my window
Cool, glad to help.
Ps, dont forget to Resolve your thread from your Thread Tools menu.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|