|
code
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Newbie: remember chkbox from closed formHi, i want to set up an Options menu.
So i created the form and put a checkbox. In order for the program to remember wether the chkbox is set or not, i guess i'll have to read from an INI or the registry. Thats fine. But I cannot get it to remember during the same session: Main form -> Menu-Options -> Options form open and i check the chkbox and close the small Options form. Back to Main. If I click on the Options again, the check box is unchecked. I guess because i reinitialize the form. Whats the shortest/easiest way to do that? I dont want to store on an ini file every during the same session of the program. Thanx in advance -steve keep the option in a variable and only save it when you exit the program.
And when you start the program , read the INI into the variable. AGP <stanto***@hotmail.com> wrote in message Show quoteHide quote news:1129393753.186770.258840@g49g2000cwa.googlegroups.com... > Hi, i want to set up an Options menu. > So i created the form and put a checkbox. > > In order for the program to remember wether the chkbox is set or not, i > guess i'll have to read from an INI or the registry. Thats fine. But I > cannot get it to remember during the same session: > > Main form -> Menu-Options -> Options form open and i check the chkbox > and close the small Options form. Back to Main. If I click on the > Options again, the check box is unchecked. I guess because i > reinitialize the form. > > Whats the shortest/easiest way to do that? I dont want to store on an > ini file every during the same session of the program. > > Thanx in advance > -steve > "AGP" <sindizzy.***@softhome.net> wrote in news:Mba4f.2721$tV6.2353 @newssvr27.news.prodigy.net:> keep the option in a variable and only save it when you exit the program. save it whenever you press the OK button to close your options form.> And when you start the program , read the INI into the variable. > > AGP > <stanto***@hotmail.com> wrote
Show quoteHide quote > Hi, i want to set up an Options menu. One easy method is to pass in the current set to a function on the> So i created the form and put a checkbox. > > In order for the program to remember wether the chkbox is set or not, i > guess i'll have to read from an INI or the registry. Thats fine. But I > cannot get it to remember during the same session: > > Main form -> Menu-Options -> Options form open and i check the chkbox > and close the small Options form. Back to Main. If I click on the > Options again, the check box is unchecked. I guess because i > reinitialize the form. > > Whats the shortest/easiest way to do that? I dont want to store on an > ini file every during the same session of the program. form, that passes back a new set of option, including any changes. For example, add a module and a Form2 to a new project. On Form1 add a command button, and on Form2 add a command button and two text boxes. Paste in the code below, and see if that will fit your need: (If there is only one value needed, you can skip using a Type and only pass the single value back and forth. The Type just makes it easy to pass several related values, such as user options) LFS '[ Module1] Public Type Options X As Long Y As Long End Type '[ Form1] Option Explicit Private User As Options Private Sub Command1_Click() User = Form2.GetOptions(User) MsgBox CStr(User.X) & ", " & CStr(User.Y) End Sub '[ Form2] Option Explicit Private User As Options Private Sub Command1_Click() User.X = Val(Text1.Text) User.Y = Val(Text2.Text) Unload Me End Sub Private Sub Form_Load() Command1.Caption = "Accept" End Sub Friend Function GetOptions(Current As Options) As Options User = Current Text1.Text = User.X Text2.Text = User.Y Me.Show vbModal GetOptions = User End Function
VB 6, SP 5 and Hyperthread
Organizing Constants for Easier Maintenance Give Focus to Background Form Count Numerous Matches Only Once XP Styles and Web Browser control VB6: What's the command that creates an ARRAY out of a STRING??? GDI API question X 2 word hyperlink + command line args VB6: Toolbar button sizeing... beyond dynamic code execution |
|||||||||||||||||||||||