Solved

VB Savesetting and getsetting for form load????

Posted on 2004-11-29
2
325 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

719 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