David,
Strings are immutable in .NET. Because of this, you will have to create
a new string, replacing the character in the string with the character that
you want. Basically, you should use the Replace method on the string, which
will return a new string with the replaced characters, like so:
foreach ( ListViewItem.ListViewSubItem subItem in Item.SubItems)
subItem.Text = subItem.Text.Replace(',', ';');
Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
-
mv*@spam.guard.caspershouse.com
"David" <an*******@discussions.microsoft.com> wrote in message
news:0c****************************@phx.gbl...
Hi,
I wanted to replace all ',' with ';' but compiler gives
me an error that my subLine is read only
foreach ( ListViewItem.ListViewSubItem subItem in
Item.SubItems)
{
subLine = subItem.Text;
int nIndex;
while ( (nIndex = subLine.LastIndexOf(',' ) ) != -
1 )
subLine[nIndex] = ';';
}
Thanks