article

Array Checkbox INI

Email
Submitted on: 1/30/2018 4:40:29 PM
By: Quake 
Level: Intermediate
User Rating: By 2 Users
Compatibility: VB 6.0
Views: 2908
 
     Array Check boxes for INI Demo "IS" included.

This article has accompanying files

 
				'//--[FORM]---------------
Option Explicit
Private Sub Check1_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
 For i = 0 To Check1.Count - 1
Check1(i).value = 0
SaveValue "Settings", "Chk1Box" & (i), Check1(i).value
 Next i
End Sub
Private Sub Check1_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
 Check1(Index).value = 1
 SaveValue "Settings", "Chk1Box" & (Index), Check1(Index).value
End Sub
Private Sub Check2_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim i As Integer
 For i = 0 To Check2.Count - 1
Check2(i).value = 0
SaveValue "Settings", "Chk2Box" & (i), Check2(i).value
 Next i
End Sub
Private Sub Check2_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
 Check2(Index).value = 1
 SaveValue "Settings", "Chk2Box" & (Index), Check2(Index).value
End Sub
Private Sub Form_Initialize()
 Call LOAD_STUFF
End Sub
'//--[MODULE]-------------
Option Explicit
'--[VARIABLES]--------------
'***************************
Dim bVal As Boolean
Dim iRay As Integer
Dim strTXT
'***************************
Public Sub LOAD_STUFF()
'--[Checking for a non-existent ini causes an error]
On Error Resume Next
'--[Error will be non-existent once ini settings is saved]
 With Form1
'//--[CHECK 1]---------------------------
For iRay = 0 To .Check1.Count - 1
 strTXT = ReadValue("Settings", "Chk1Box" & iRay, "")
If strTXT > "" Then
.Check1(iRay).value = strTXT
 Else
.Check1(iRay).value = 0
 End If
Next
'//--[CHECK 1]---------------------------
'//--[OPTIONAL]--------------------------
'//--[FORCE RECHECK]---------------------
'//--[DEFAULT CHECK]---------------------
For iRay = 0 To .Check1.Count - 1
 If .Check1(iRay).value = 1 Then
bVal = True
Exit For
 Else
bVal = False
 End If
Next iRay
If bVal = False Then
 .Check1(2).value = 1
 SaveValue "Settings", "Chk1Box" & (2), .Check1(2).value
End If
'//--[CHECK 2]---------------------------
For iRay = 0 To .Check2.Count - 1
 strTXT = ReadValue("Settings", "Chk2Box" & iRay, "")
If strTXT > "" Then
.Check2(iRay).value = strTXT
 Else
.Check2(iRay).value = 0
 End If
Next
'//--[CHECK 2]---------------------------
'//--[OPTIONAL]--------------------------
'//--[FORCE RECHECK]---------------------
'//--[DEFAULT CHECK]---------------------
For iRay = 0 To .Check2.Count - 1
 If .Check2(iRay).value = 1 Then
bVal = True
Exit For
 Else
bVal = False
 End If
Next iRay
If bVal = False Then
 .Check2(6).value = 1
 SaveValue "Settings", "Chk2Box" & (2), .Check2(2).value
End If
 End With
 
End Sub

winzip iconDownload article

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
  3. Scan the source code with Minnow's Project Scanner

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com


Other 32 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this article (in the Intermediate category)?
(The article with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

3/9/2018 9:41:12 AMRob

I reckon you would get more votes if you attached working projects INSTEAD
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular article, please click here instead.)
 

To post feedback, first please login.