gettingstarted
[Top] [All Lists]

Re: Check boxes

To: Getting Started <gettingstarted at lists dot realsoftware dot com>
Subject: Re: Check boxes
From: Richard Rhyan <tweazer at wowway dot com>
Date: Fri, 29 Oct 2004 06:29:08 -0500
Delivered-to: gettingstarted at lists dot realsoftware dot com
References: <20 dot 36a00293 dot 2eb36db4 at aol dot com>
One way I would do this, instead of using a 1 or a 0 is to write two small global methods like this (I believe I read this in a book, I can't which one):

Function Bool2Str(s As String) As Boolean
  Dim v As Variant
  v = s
  Return v
End Function

Function Str2Bool(b As Boolean) As String
  Dim v As Variant
  v = b
  Return v
End Function

Then when you want to write to your preferences file, you just use something like this:
myStream.Write Bool2Str(myCheckbox.value)

And when reading from the prefs file, you'd use this:
myCheckbox.Value = Str2Bool(myStream.ReadLine)

-Richard


On Oct 29, 2004, at 4:56 AM, GAmoore at aol dot com wrote:

well what you must do is save the checkbox state to a preferences file
of sorts
then when your application opens again, it loads the info it saved and
sets the last state
it was at


To fill in some details .... create and write a file, put 1 for on, 0 for off when closing the app. then when opening, look to see if the file exists, read it, and if 1 make the checkbox true, 0 make it false. You use readlines and
writelines.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>


_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://www.realsoftware.com/listarchives/lists.html>

<Prev in Thread] Current Thread [Next in Thread>