Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27465

String is read only

$
0
0
Hi. I am new to this as I hardly used VS2008. I have some code where I am trying to replace charecters in a string
Code:

    Private Sub ASC(ByRef MyStartString As String)
        Dim temp As String
        Dim x As Integer = 2
        Dim MyChar As Char
        Dim MyAsc As Integer
        Dim strLength As Integer
        strLength = temp.Length
 
        temp = MyStartString
        MyChar = temp.Chars(0)
        MyAsc = AscW(MyChar)
        MyAsc = MyAsc + 1 'x
        MyChar = Chr(MyAsc)
        temp.Chars(0) = MyChar ' Chars is ReadOnly
    End Sub

Probably not the best of code but I am trying to change a string by changing the values of temp. I can then replace MyStartString with the new string.

Viewing all articles
Browse latest Browse all 27465

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>