VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Save and restore TrueDBGrid Column width settings

by Andrew Shelomanov (3 Submissions)
Category: Registry
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Mon 17th April 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Save and restore TrueDBGrid Column width settings

Rate Save and restore TrueDBGrid Column width settings




Private Sub Form_Load()
    Call TDBGRestore(frmShifts, grdShifts)
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call TDBGSave(frmShifts, grdShifts)
End Sub
 

'Place this code in a module

'===============================================================================
'Description:   Restores Grid Settings
'PARAMETERS:    frm             - Form
'               TDBG            - TDBGrid 
'               iSplit          - Split Number
'
Public Sub TDBGRestore(frm As Form, TDBG As TDBGrid, Optional iSplit As Integer = 0)
    Dim i As Integer, Col As Column, s As String

    i = 0
    For Each Col In TDBG.Columns
        s = Trim(frm.Name) & TDBG.Name & CStr(i)
        TDBG.Columns(i).Width = GetRegistryLong(s, TDBG.Columns(i).Width, "GridSetup")
        i = i + 1
    Next
End Sub
'===============================================================================
'Description:   Saves Grid Settings
'PARAMETERS:    frm             - Form
'               TDBG            - TrueDBGrid
'               iSplit          - Split Number
'
Public Sub TDBGSave(frm As Form, TDBG As TDBGrid, Optional iSplit As Integer = 0)
    Dim i As Integer, lX As Long, Col As Column, s As String
     
    i = 0
    For Each Col In TDBG.Columns
        lX = TDBG.Columns(i).Width
        s = Trim(frm.Name) & TDBG.Name & CStr(i)
        Call SetRegistryLong(s, lX, "GridSetup")
        i = i + 1
    Next
 
End Sub


Download this snippet    Add to My Saved Code

Save and restore TrueDBGrid Column width settings Comments

No comments have been posted about Save and restore TrueDBGrid Column width settings. Why not be the first to post a comment about Save and restore TrueDBGrid Column width settings.

Post your comment

Subject:
Message:
0/1000 characters