>Hoping someone can guide an C# newbie. I'm looping through an array, and I want to add each element to a listbox on the form. But for each item, I want to preference it with the element name/number. I can't get past the compiler error with the code below, but if I remove the ctext="PID:" += i.ToString(); line it does add the text of the array item to the listbox.
>
>
>PID:1 element 1 text
>PID:2 element 2 text
>...
>
>
>
Try the updated code:
string[] PID_Data = PIDString.Split(fieldSplitter);
string ctext = String.Empty;
for(int i=0;i<PID_Data.Length;i++)
{
ctext = "PID: " & i.ToString() & PID_Data[i];
listBox1.Items.Add(ctext);
ctext = String.Empty;
}