Hi,
I've got a DataTable and one of the columns (named 'ReasonForChange') in the DataTable may contain two right square brackets (]]). (I need to store carriage-return line-feeds as two right square brackets since the program that reads the data from the database chokes if it encounters a CRLF).
My problem is this: when I loop through my DataTable, I'm attempting to replace all instances of the brackets with a
Chr(13)+Chr(10). What happens is that instead of replacing it with that, it's just inserting spaces.
Here's my loop:
For example, one of the ReasonForChange fields could look like this in the database:
Address changed temporarily.]]Will return next month.
I'd like for it to be outputted in my DataGrid the same way that the user inputted it - like this:
Address changed temporarily.
Will return next month.
Except it ends up looking like this:
Address chaned temporarily. Will return next month.
Can anyone tell me what I'm doing wrong?
Thanks in advance,
Suzanne
I've got a DataTable and one of the columns (named 'ReasonForChange') in the DataTable may contain two right square brackets (]]). (I need to store carriage-return line-feeds as two right square brackets since the program that reads the data from the database chokes if it encounters a CRLF).
My problem is this: when I loop through my DataTable, I'm attempting to replace all instances of the brackets with a
Chr(13)+Chr(10). What happens is that instead of replacing it with that, it's just inserting spaces.
Here's my loop:
Code:
For Each dsRow in dsLogOfChanges.Tables("Log").Rows
If(InStr(dsRow.Item("ReasonForChange").ToString, "]]") <> 0) Then
dsRow.Item("ReasonForChange") = Replace(dsRow.Item("ReasonForChange"), "]]", Chr(13)+Chr(10))
End If
Next
For example, one of the ReasonForChange fields could look like this in the database:
Address changed temporarily.]]Will return next month.
I'd like for it to be outputted in my DataGrid the same way that the user inputted it - like this:
Address changed temporarily.
Will return next month.
Except it ends up looking like this:
Address chaned temporarily. Will return next month.
Can anyone tell me what I'm doing wrong?
Thanks in advance,
Suzanne