Solved

Maximize DataGrid With Form

Posted on 2002-05-21
3
603 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
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

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

810 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