Hello All,
I'm transfering some bools from another form as string to main Form. Here I split them and convert them again to bool.
First of all, is there another way to transfer bools between form?
Second, how can I convert different strings with different amount of bool values in one class or subroutine?
for example string b1;b2;b3;b4 (4 different bool values in one string)
and string a1;a2 (2 different bool values in one string)
and c1;c2;c3;c4;c5 (5 different bool values in one string)
How could I sent the strings in different times to one Subroutine or class which returns me the bool values?
I still can't understand this oop programming I think... (((
Thanx in advance

VulpesPosted Aug 17, 2012, 10:22 AM
If the number of bools is not fixed then a List
If you stick to using strings, then you'll have to unpack the bools using the String.Split method:
string s = "true;false;true;false"; // or whatever
string[] sa = s.Split(';');
bool[] ba = new bool[sa.Length];
for(int i = 0; i < sa.Length; i++)
{
ba[i] = Convert.ToBoolean(sa[i]);
}
ilhami caliskanPosted Aug 17, 2012, 10:58 AM
how I can pass arrays between forms?
ilhami caliskanPosted Aug 17, 2012, 10:32 AM