Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB How-To
|
VB How-To Ask your "How do I do this with VB?" questions in this forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB How-To section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 22nd, 2004, 04:22 PM
Authorized User
 
Join Date: Jul 2004
Posts: 34
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via ICQ to chipset Send a message via MSN to chipset Send a message via Yahoo to chipset
Default Updating controls on forms at run-time

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..

__________________
Arowolo
 
Old September 23rd, 2004, 05:02 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 627
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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
 
Old September 23rd, 2004, 07:26 PM
Authorized User
 
Join Date: Jul 2004
Posts: 34
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via ICQ to chipset Send a message via MSN to chipset Send a message via Yahoo to chipset
Default

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

 
Old September 24th, 2004, 06:22 AM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old September 24th, 2004, 07:06 PM
Authorized User
 
Join Date: Jun 2003
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
Default

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


 
Old September 25th, 2004, 05:25 AM
Authorized User
 
Join Date: Jul 2004
Posts: 34
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via ICQ to chipset Send a message via MSN to chipset Send a message via Yahoo to chipset
Default

thanks a lot
it worked...:)






Similar Threads
Thread Thread Starter Forum Replies Last Post
Creating Controls At Run-Time robbev567 ASP.NET 2.0 Basics 2 July 25th, 2007 04:57 AM
Create Controls in Run Time Fredu Access 3 January 8th, 2005 10:03 AM
Copying controls at run time aspadda Excel VBA 0 November 12th, 2003 01:07 PM
Adding controls at run-time !! kishore_peddi C# 0 October 13th, 2003 06:52 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.