Hello All,
I'm using VB6. I've got a form that contains a frame that contains a datagrid and a cmdbutton. In my form_resize event I call a sub ResizeFrame which resizes the frame just a bit smaller than the form. Inside ResizeFrame I resize the datagrid (width a bit smaller than the frame and height minus enough height to fit a command button below the datagrid). I enforce minheight and minwidth for the form. Everythings works fine but dynamically moving the cmdbutton! How could I always force the command button to stay just a bit below the grid? Any suggestions would be great! TIA
Here's my code
Private Sub ResizeFrame()
Dim fra As Control ' Test for Frame
For Each fra In Me.Controls ' Get all controls
If TypeOf fra Is Frame Then
If fra.Visible = True Then
fra.Top = 10
fra.Left = 0
fra.Width = frmMain.ScaleWidth
fra.Height = frmMain.Height - 1200
Exit For 'We found the control to change. Only one frame visible at a time FOR NOW
End If
End If
Next
DataGrid1.Width = Me.fraCustomerView.Width - 50 'Think of way to make this work with the frame that's visible
DataGrid1.Height = Me.fraCustomerView.Height - 1000
'Call ResizeDataGrid this sub not working
End Sub
Private Sub Form_Resize()
'Check to see if form's getting too
'small forcing a min height and width
If Me.WindowState = vbMinimized Then Exit Sub 'Avoid error-NO resize if minimized
If MinHeight > frmMain.Height Then
frmMain.Height = MinHeight
ElseIf MinWidth > frmMain.Width Then
frmMain.Width = MinWidth
End If
Call ResizeFrame
End Sub
Private Sub ResizeDataGrid()
Dim grid As Control ' Test for datagrid
For Each grid In Me.Controls ' Get all controls
If TypeOf grid Is DataGrid Then
If grid.Visible = True Then
grid.Width = Me.fraCustomerView.Width - 50 'Think of way to make this work with the frame that's visible
grid.Height = Me.fraCustomerView.Height - 1000
End If
Exit For 'Found the control to change. Only one frame visible at a time FOR NOW
End If
Next
End Sub
Any suggestions would be super!
I'm using VB6. I've got a form that contains a frame that contains a datagrid and a cmdbutton. In my form_resize event I call a sub ResizeFrame which resizes the frame just a bit smaller than the form. Inside ResizeFrame I resize the datagrid (width a bit smaller than the frame and height minus enough height to fit a command button below the datagrid). I enforce minheight and minwidth for the form. Everythings works fine but dynamically moving the cmdbutton! How could I always force the command button to stay just a bit below the grid? Any suggestions would be great! TIA
Here's my code
Private Sub ResizeFrame()
Dim fra As Control ' Test for Frame
For Each fra In Me.Controls ' Get all controls
If TypeOf fra Is Frame Then
If fra.Visible = True Then
fra.Top = 10
fra.Left = 0
fra.Width = frmMain.ScaleWidth
fra.Height = frmMain.Height - 1200
Exit For 'We found the control to change. Only one frame visible at a time FOR NOW
End If
End If
Next
DataGrid1.Width = Me.fraCustomerView.Width - 50 'Think of way to make this work with the frame that's visible
DataGrid1.Height = Me.fraCustomerView.Height - 1000
'Call ResizeDataGrid this sub not working
End Sub
Private Sub Form_Resize()
'Check to see if form's getting too
'small forcing a min height and width
If Me.WindowState = vbMinimized Then Exit Sub 'Avoid error-NO resize if minimized
If MinHeight > frmMain.Height Then
frmMain.Height = MinHeight
ElseIf MinWidth > frmMain.Width Then
frmMain.Width = MinWidth
End If
Call ResizeFrame
End Sub
Private Sub ResizeDataGrid()
Dim grid As Control ' Test for datagrid
For Each grid In Me.Controls ' Get all controls
If TypeOf grid Is DataGrid Then
If grid.Visible = True Then
grid.Width = Me.fraCustomerView.Width - 50 'Think of way to make this work with the frame that's visible
grid.Height = Me.fraCustomerView.Height - 1000
End If
Exit For 'Found the control to change. Only one frame visible at a time FOR NOW
End If
Next
End Sub
Any suggestions would be super!