Solved

VB Savesetting and getsetting for form load????

Posted on 2004-11-29
2
312 Views
Last Modified: 2011-10-03
I am using VB 6 and to do this i understand you have to use the savesetting and getsetting function just im not to sure on these functions.

What i want to do is:     Basic Example

i want to have 2 forms, when you run the program both forms load at once, on form 2 i want to have a check box.  what i want to happen is that when the check box on form 2 is check, when you run the program form 1 dosnt load, i want this setting to save for everytime the program is run until the check box is uncheck then form 1 will load, this must also save. if you understand?

anyone?????

Cheers.
0
Comment
Question by:On_The_Level
2 Comments
 
LVL 28

Accepted Solution

by:
vinnyd79 earned 30 total points
ID: 12699868
Try adding this to a bas module and set the Projects startup object to Sub Main:

Sub Main()
Dim rVal As String
rVal = GetSetting(App.EXEName, "Settings", "Form2")
If rVal = "Checked" Then
    Form2.Show
Else
    Form1.Show
    Form2.Show
End If

End Sub

Then try adding this to Form2:

Private Sub Check1_Click()
If Check1.Value = 1 Then
    Call SaveSetting(App.EXEName, "Settings", "Form2", "Checked")
Else
    Call SaveSetting(App.EXEName, "Settings", "Form2", "")
End If

End Sub

Private Sub Form_Load()
Dim rVal As String
rVal = GetSetting(App.EXEName, "Settings", "Form2")
If rVal = "Checked" Then
    Check1.Value = 1
End If

End Sub
0
 
LVL 23

Expert Comment

by:gecko_au2003
ID: 12880945
You could also research how to use the fso to write to a text file or ini file and write the settings to that file and determine from the file whether or not to load form1 or form1 and form2 just by reading the values from the text file. That is another way, probably harder then the first though, not sure.
0

Featured Post

ScreenConnect 6.0 Free Trial

Want empowering updates? You're in the right place! Discover new features in ScreenConnect 6.0, based on partner feedback, to keep you business operating smoothly and optimally (the way it should be). Explore all of the extras and enhancements for yourself!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

832 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question