Solved

VB Savesetting and getsetting for form load????

Posted on 2004-11-29
2
304 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
Comment Utility
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
Comment Utility
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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

771 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now