A
Anthony Papillion
Hello Everyone,
I'm writing an application where the user will need to select any
combination of several options represented by a series of checkboxes. I then
need to save certain information in a flat file based on what the user
selected. For example, if the user selected checkbox1 and checkbox4 I will
save text that represent checkbox1 and checkbox4, if they select others, I
will also save text that represents those values.
Each time the application loads, I'm going to load these values and make
decisions based on what the user selected. Simple, I know. Right now, I'm
storing the values in one long colon delimited string like:
checkbox1:checkbox3:checkbox4
which I then read into an array using the Split() method. That works very
well IF the user selects more than one checkbox. But, if the user ONLY
selects one checkbox then the code gets a bit more complicated as I don't
want to store the delimiting colon since I won't need to perform the split.
I know this isn't the most elegant way to accomplish this and I'd like
opinions on how I should best handle this? Do I need to delimit the values
at all and, if so, what is the best way to do so?
Thanks in advance,
Anthony
I'm writing an application where the user will need to select any
combination of several options represented by a series of checkboxes. I then
need to save certain information in a flat file based on what the user
selected. For example, if the user selected checkbox1 and checkbox4 I will
save text that represent checkbox1 and checkbox4, if they select others, I
will also save text that represents those values.
Each time the application loads, I'm going to load these values and make
decisions based on what the user selected. Simple, I know. Right now, I'm
storing the values in one long colon delimited string like:
checkbox1:checkbox3:checkbox4
which I then read into an array using the Split() method. That works very
well IF the user selects more than one checkbox. But, if the user ONLY
selects one checkbox then the code gets a bit more complicated as I don't
want to store the delimiting colon since I won't need to perform the split.
I know this isn't the most elegant way to accomplish this and I'd like
opinions on how I should best handle this? Do I need to delimit the values
at all and, if so, what is the best way to do so?
Thanks in advance,
Anthony