Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

VB Savesetting and getsetting for form load????

Posted on 2004-11-29
2
Medium Priority
?
369 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 90 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
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…
Suggested Courses

636 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