ListBox l = new ListBox(); ListBox l2 = new ListBox(); l.Items.Add("1"); l.Items.Add("2"); l.Items.Add("3"); l2.Items.Add("1"); l2.Items.Add("12"); l2.Items.Add("112"); ArrayList list = new ArrayList(); foreach (object o in l.Items) { if (l2.Items.IndexOf(o) == -1) { list.Add(o); } }
ListBox l = new ListBox(); ListBox l2 = new ListBox(); l.Items.Add("1"); l.Items.Add("2"); l.Items.Add("3"); l2.Items.Add("1"); l2.Items.Add("12"); l2.Items.Add("112"); ArrayList list = new ArrayList(); foreach (object o in l.Items) { if (l2.Items.IndexOf(o) == -1) { list.Add(o); } } foreach (object o in l2.Items) { if (l.Items.IndexOf(o) == -1) { list.Add(o); } }
string result = ""; for(int i=0;i<listBox1.Items.Count;i++) { int index = listBox2.FindString(listBox1.Items[i].ToString()); if(index > -1) if(i!=listBox1.Items.Count - 1) result += "1,"; else result += "1"; else if(i!=listBox1.Items.Count - 1) result += "0,"; else result += "0"; }
System.Collections.ArrayList array = new System.Collections.ArrayList();
foreach (object obj in this.listBox1.Items) { if (this.listBox1.Items.IndexOf(obj) != -1) array.Add(1); else array.Add(2); } string[] strs=(string []) array.ToArray(typeof(string));
System.Collections.ArrayList array = new System.Collections.ArrayList(); foreach (object obj in this.listBox1.Items) { if (this.listBox2.Items.IndexOf(obj) != -1) array.Add(1); else array.Add(0); } string[] strs=(string []) array.ToArray(typeof(string));
ListBox l2 = new ListBox();
l.Items.Add("1");
l.Items.Add("2");
l.Items.Add("3"); l2.Items.Add("1");
l2.Items.Add("12");
l2.Items.Add("112"); ArrayList list = new ArrayList();
foreach (object o in l.Items)
{
if (l2.Items.IndexOf(o) == -1)
{
list.Add(o);
}
}
ListBox l2 = new ListBox();
l.Items.Add("1");
l.Items.Add("2");
l.Items.Add("3"); l2.Items.Add("1");
l2.Items.Add("12");
l2.Items.Add("112"); ArrayList list = new ArrayList();
foreach (object o in l.Items)
{
if (l2.Items.IndexOf(o) == -1)
{
list.Add(o);
}
} foreach (object o in l2.Items)
{
if (l.Items.IndexOf(o) == -1)
{
list.Add(o);
}
}
string result = "";
for(int i=0;i<listBox1.Items.Count;i++)
{
int index = listBox2.FindString(listBox1.Items[i].ToString());
if(index > -1)
if(i!=listBox1.Items.Count - 1)
result += "1,";
else
result += "1";
else
if(i!=listBox1.Items.Count - 1)
result += "0,";
else
result += "0";
}
System.Collections.ArrayList array = new System.Collections.ArrayList();
foreach (object obj in this.listBox1.Items)
{
if (this.listBox1.Items.IndexOf(obj) != -1)
array.Add(1);
else
array.Add(2);
}
string[] strs=(string []) array.ToArray(typeof(string));
System.Collections.ArrayList array = new System.Collections.ArrayList();
foreach (object obj in this.listBox1.Items)
{
if (this.listBox2.Items.IndexOf(obj) != -1)
array.Add(1);
else
array.Add(0);
}
string[] strs=(string []) array.ToArray(typeof(string));