Not the nicest solution of filtering out the interesting part, but it works:
Dim newParam As String = "ACK"
Dim test As String = "MDSP:TSK:Demo:MDSR:Demo:::LAT:Test:P:2.3:"
Dim nStartExchange As Integer = test.IndexOf("::") + 3
Dim res As String = test.Substring(nStartExchange, test.Length - nStartExchange)
Dim nEndExchange As Integer = res.IndexOf(":"C) + nStartExchange
Dim result As String = test.Substring(0, nStartExchange) & newParam & test.Substring(nEndExchange)
MessageBox.Show(result)
I think you could also try using regular expressions in this case, but the above code works quite well for the string that you wanted to modify.
Another possible solution:
Dim newParam As String = "ACK"
Dim test As String = "MDSP:TSK:Demo:MDSR:Demo:::LAT:Test:P:2.3:"
Dim results As String() = test.Split(":"C)
Dim final As String = ""
results(7) = newParam
For i As Integer = 0 To results.Length - 1
final += results(i)
If i <> results.Length - 1 Then
final += ":"
End If
Next
MessageBox.Show(final)
Hope it helps!