SaveGetSettings
Fed up with saving and loading your form's settings? Well save this module and with one line of code you can save its's size and position. One more line and you save _All_ the text and check boxes values. Come on this is a great time saver - how about a vote ??? Only missing option buttion settings... maybe next week.....
AI
एआई सारांश: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
सोर्स कोड
Public Sub SaveValues(frmForm As Form) ' ' usage = place: ' Call SaveValues(Me) ' in the Form_Unload event ' this will save all checkbox and textbox settings ' Dim ctlControl As Object On Error Resume Next For Each ctlControl In frmForm.Controls SaveSetting App.Title, "Settings", ctlControl.Name, ctlControl.Value 'check boxes..... SaveSetting App.Title, "Settings", ctlControl.Name, ctlControl.Text DoEvents Next ctlControl End Sub Public Sub SavePositions(frmForm As Form) ' ' usage = place: ' Call SavePositions(Me) ' in the Form_Unload event ' this will save the forms size and position ' On Error Resume Next If frmForm.WindowState = vbMinimized Then: Exit Sub 'don't want to come back minimized!!! SaveSetting App.Title, "Settings", frmForm.Name & "top", frmForm.Top SaveSetting App.Title, "Settings", frmForm.Name & "left", frmForm.Left SaveSetting App.Title, "Settings", frmForm.Name & "width", frmForm.Width SaveSetting App.Title, "Settings", frmForm.Name & "height", frmForm.Height End Sub Public Sub GetValues(frmForm As Form) ' ' usage = place: ' Call GetValues(Me) ' in the Form_Load event ' this will populate all checkbox and textbox settings ' Dim ctlControl As Object On Error Resume Next For Each ctlControl In frmForm.Controls 'check boxes..... ctlControl.Value = GetSetting(App.Title, "Settings", ctlControl.Name) 'text boxes ctlControl.Text = GetSetting(App.Title, "Settings", ctlControl.Name) DoEvents Next ctlControl End Sub Public Sub GetPositions(frmAForm As Form) ' ' usage = place: ' Call GetPositions(Me) ' in the Form_Load event ' this will save the forms size and position ' On Error Resume Next frmAForm.Top = GetSetting(App.Title, "Settings", frmAForm.Name & "top", "30") frmAForm.Left = GetSetting(App.Title, "Settings", frmAForm.Name & "left", "30") frmAForm.Width = GetSetting(App.Title, "Settings", frmAForm.Name & "width") frmAForm.Height = GetSetting(App.Title, "Settings", frmAForm.Name & "height") End Sub
मूल टिप्पणियाँ (3)
Wayback Machine से पुनर्प्राप्त