Subject: Updating controls on forms at run-time
Posted By: chipset Post Date: 9/22/2004 4:22:09 PM
hi,

Am kind of having a problem in updating the controls on my form. for example, if i have Text1.text on a form, and at run-time, i typed something inside it. how will i make the text1.text control remember or save the las change made to it...

please kindly help..

Reply By: marcostraf Reply Date: 9/23/2004 5:02:28 PM
do you mean when the app start again you want Text1 to rememeber the last enetered text? Look for the SaveSetting and GetSetting methods
Marco
Reply By: chipset Reply Date: 9/23/2004 7:26:30 PM
yes, i did try to use the savesetting ang get.. function. but it was given some error. may be you can demostrate how to use it for me, using the my old example (text1.text)
thanks

Reply By: dunnie Reply Date: 9/24/2004 6:22:38 AM
Here, try this.

This uses the registry to save the value of Text1 on form unload and then retrieves it from the registry and loads the text box on form load.

Private Sub Form_Load()
  Text1 = GetSetting(App.Title, "Properties", "Settings", "")
End Sub

Private Sub Form_Unload(Cancel As Integer)
  SaveSetting App.Title, "Properties", "Settings", Text1.Text
End Sub


Reply By: dunnie Reply Date: 9/24/2004 7:06:32 PM
You can use this to load a default value into Text1 if there is no registry entry yet

Private Sub Form_Load()
  Text1 = GetSetting(App.Title, "Properties", "Settings", "What ever you want here")
End Sub


Reply By: chipset Reply Date: 9/25/2004 5:25:25 AM
thanks a lot
it worked...


Go to topic 19342

Return to index page 764
Return to index page 763
Return to index page 762
Return to index page 761
Return to index page 760
Return to index page 759
Return to index page 758
Return to index page 757
Return to index page 756
Return to index page 755