Solved

Maximize DataGrid With Form

Posted on 2002-05-21
3
606 Views
Last Modified: 2008-02-26
I'm using VB6 against an SQL Server database.

From the main application screen a form is launched which has a DataGrid on the form.
It's a Sheridan datagrid but has many of the same properties as a Microsoft datagrid.
The user can maximize the form but the datagrid doesn't resize along with the form.
Is there a way I can resize my datagrid when the user maximizes the form?
And if so, which event would this code be placed into?

Thanks in Advance.
John
0
Comment
Question by:jtrapat1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
ID: 7024128
Private Sub Form_Resize()
  On Error Resume Next
  DataGrid1.Height = Me.Height
  DataGrid1.Width = Me.Width
End Sub

Or adjust the height/width/top/left to correctly size within the form.

You need the on error as if the form is minimized or resized too small you may generate an error because the datagrid height or width may go less than zero.
0
 
LVL 2

Expert Comment

by:Ixeus
ID: 7024140
Private Sub Form_Resize()

    On Error Goto 0

    grd.top = coords here
    grd.left = coords here
    grd.height = me.scaleHeight - grd.left
    grd.width = me.scaleWidth - grd.top
       
   
End Sub


something like that, don't have VB on this comp now, just a guide I hope it works for you =)
0
 
LVL 2

Expert Comment

by:Ixeus
ID: 7024143
on error resume next not 0 sorry
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question