Re: How to change the value of Boolean variable?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



There is no correct or perfect way but in this case I would probably just
store a Bit value to determine if Bold is set.

In the ini file I would store:
ButtonsFontType = 0
--or--
ButtonsFontType = 1

Then evaluate that value to set the bold of your command buttons.

--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
http://www.veign.com/vrc_main.asp
Veign's Blog
http://www.veign.com/blog
--


"Jack" <replyto@newsgroup> wrote in message
news:OiBe$X$1FHA.3276@xxxxxxxxxxxxxxxxxxxxxxx
>I am just not sure how to store in ini file (and later to read it from) the
>preferences which are Boolean type.
> For example I want to save in ini file .FontBold
> 1-st question: Is this correct?
> 'ButtonsFontType
> U = WritePrivateProfileString(lpAppName, "ButtonsFontType",
> CmdS(1).FontBold, lpFileName)
>
> Second question:
> When loading (reading) that 'ButtonsFontType preference:
> X = GetPrivateProfileString(lpAppName, "ButtonsFontType", lpDefault,
> sName, Len(sName), lpFileName)
> If X > 0 Then myVar = Left(sName, X) Else myVar = False
>
> Is that correct way of programming or it needs some corrections?
> Thanks,
> Jack
>
> "Veign" <NOSPAMinveign@xxxxxxxxx> wrote in message
> news:OIkFcJ$1FHA.3256@xxxxxxxxxxxxxxxxxxxxxxx
>> myVar = CBool(lpString)
>>
>> Not sure what your exact question is. You should explicitly cast teh
>> variable to a differnt type - in your case string to boolean. In your
>> case VB is handling this for you.
>>
>> Be aware that "True" is not true in all languages.
>>
>> --
>> Chris Hanscom - Microsoft MVP (VB)
>> Veign's Resource Center
>> http://www.veign.com/vrc_main.asp
>> Veign's Blog
>> http://www.veign.com/blog
>> --
>>
>>
>> "Jack" <replyto@newsgroup> wrote in message
>> news:e5jLtB$1FHA.3856@xxxxxxxxxxxxxxxxxxxxxxx
>>> dim MyVar as Boolean
>>> dim lpString as String
>>>
>>> lpString = "True"
>>> myVar = lpString
>>>
>>> My vbasic5 dos not object that and assigns True value to myVar.
>>>
>>> Is this correct way, or it is wrong?
>>> Your thoughts please,
>>> Jack
>>>
>>
>>
>
>


.



Relevant Pages

  • Re: TRUE is 0 is FALSE
    ... An explicit literal - in string form - for boolean values don't seem ... equivalent simpler code that does not store a boolean in a variable. ... it will reflect the exit status of the last command in the ... the prominent shells support some form ...
    (comp.unix.shell)
  • Re: How to work with multiple response sets in Access
    ... simple checkboxes. ... but it gets simpler if I have only one survey ... and a table to store each answer to each question for each survey ... store the values in a Boolean field in the answers table, ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Crash saving boolean value to RS (Row cannot be located...)
    ... Brendan Reynolds ... > Close RecordSet ... > The issue I'm dealing with is that I was attempting to store the Gender ... >> What if you give the Boolean field a default value. ...
    (microsoft.public.data.ado)
  • Re: Can a boolean ever be set to null?
    ... of bits to store, ... boolean actually takes more bits to store than a Byte, ... but I suspect that all the boolean fields in a table may ... Dirk Goldgar, MS Access MVP ...
    (microsoft.public.access.modulesdaovba)
  • Re: Do as I say, not as I do.
    ... let alone be that bold to ... actually drive his car with political plates to a New Hampshire liquor ...
    (rec.boats)