SaveSetting: Option Button

Rashka
09-18-2004, 09:16 PM
It has been a while since I have used Save/Get Setting. I don't need to know the full SaveSetting string, but what I do need is how to save a setting for an option button. I have 3 OB's, and only need to save for what one is selected. I know that to save/Get Setting it is like:

SaveSetting App.Title, "Section", "Key", 'This is where I am unsure

GetSetting (App.Title, "Section", "Key", Something here)


As you can see, it is only how to save the option button part, and how to read it, that I am unsure.

huntercobrax
09-18-2004, 09:36 PM
SaveSetting App.Title, "Section", "Key", 0

intOption = Int(GetSetting(App.Title, "Section", "Key", 0))
Select Case intOption
Case 0: OptionButton.Value = True
End Select

Rashka
09-18-2004, 10:33 PM
Thanks, works like a charm. However, I decided to step through my code, and noticed something. My code works on its own (in the sub, not called from a seperate sub). I have the code in a different sub, and using the option button value, I determine which sub to call, from a possible 3. Calling the sub though does not work. Here is my code.

This Works

filenum = FreeFile
Open filespec For Binary As #filenum

For x = 1 To 5

'// set overwriting character
If x = 1 Then
wipeout = 35 '#
ElseIf x = 2 Then
wipeout = 88 'X
ElseIf x = 3 Then
wipeout = 126 '~
ElseIf x = 4 Then
wipeout = 53 '5
Else
wipeout = 32 'space
End If

'// create the overwriting ByteArray
For i = 0 To UBound(ByteArray)
ByteArray(i) = wipeout
Next i

'// overwrite original file with wipeout character
Put #filenum, 1, ByteArray()

Next x

Close #filenum

This Does Not

filenum = FreeFile
Open filespec For Binary As #filenum

'select the file overwrite method
intOption = Int(GetSetting(App.Title, "S_D", "OW_Num", 3))
Select Case intOption
Case 3: Sub3
Case 5: Sub5
Case 7: Sub7
End Select

Close #filenum


The Sub is

Private Sub Sub5()
For x = 1 To 5

'// set overwriting character
If x = 1 Then
wipeout = 35 '#
ElseIf x = 2 Then
wipeout = 88 'X
ElseIf x = 3 Then
wipeout = 126 '~
ElseIf x = 4 Then
wipeout = 53 '5
Else
wipeout = 32 'space
End If

'// create the overwriting ByteArray
For i = 0 To UBound(ByteArray)
ByteArray(i) = wipeout
Next i

'// overwrite original file with wipeout character
Put #filenum, 1, ByteArray()

Next x
End Sub


Exactly the same as before. The problem is, when it is in the main sub, it goes through all the overwrite chars. When called from another sub, it only goes through the first overwrite char. Why? Any ideas anyone?

EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum