I want to make a program that saves the states of about 50 checkboxes, so that I can keep track of the states I have been in. I also want to have four different save and load buttons, so that I can keep track of the states the 3 other family members in my family have been in.

Here is the code that is was using that didn't work:

Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Dim Write As New System.IO.StreamWriter("c:data/Box1.dll")
        Write.Write(CheckBox1.CheckState)
        Write.Close()
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim Read As New System.IO.StreamReader("c:data/Box1.dll")
        CheckBox1.CheckState = Read.ReadToEnd
        Read.Close()
    End Sub
End Class

This is only the Load and Save buttons with one checkbox.

Recommended Answers

All 3 Replies

So you want to have 50 checkboxes, one for each U.S. state and track who has been in what state. All a checkbox will tell you is if or not it is checked. not who did or didn't check it.

Are you keeping a Dll file to hold who has been where?

I would have used a data grid to show the break down with columns like this:
State, Me, FamilyMember1, FamilyMember2, FamilyMember3

Under State you list the state, under your column and each familymember put a checkbox with it checked if they have been there.

You can store the data in a csv file and populate the whole thing from the file that way if you want to add another family member you just add a new column to the csv file.

So the CSV would look something like:

State, Me, Member1, Member2, Member3
Alabama,False,True,False,False
Alaska,False,False,False,False
Arizona,True,True, False, True
....
Wyoming,False,False,False,True

Perhaps a slight mod to the above suggestion, save one line per family member with 50 boolean values for the 50 states (in alphabetical order). That way you don't have to change the file format or the input/output logic if you want to add another person.

Mom,T,T,F,F,T,F...

Well, I was planning on having 4 different saves. 1 for each member.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.