Adding the items in a checkedListBox:
DirectoryInfo dinfo = new DirectoryInfo(@"D:\\templates");
FileInfo[] Files = dinfo.GetFiles("*.xml");
foreach (FileInfo file in Files)
{
checkedListBox1.Items.Add(file.Name);
}
foreach (string i in checkedListBox1.CheckedItems)
{
string[] array1 = i;
for (int k = 0; k < array1.Length; k++)
{
XmlDocument xdoc1 = new XmlDocument();
xdoc1.Load(array1[k]);
string s1 = array1[k].ToUpper();
int n = s1.IndexOf(array1[k]);
name1 = array1[k].Substring(n);
}
When I’m putting it in an array, with (string[] array1 = i;)
it’s an giving error:
Cannot implicitly convert type ‘string’ to ‘string[]’ “
any suggestions?
You can not do that. You will need to do something like this
You are trying to assign
stringtostring[]. Which is not allowed.