Solved

Maximize DataGrid With Form

Posted on 2002-05-21
3
600 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
  • 2
3 Comments
 
LVL 43

Accepted Solution

by:
TimCottee earned 50 total points
Comment Utility
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
Comment Utility
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
Comment Utility
on error resume next not 0 sorry
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now