This is almost always about preparing the string for use in an SQL statement. If that's not what's going on here you can disregard this. But if it is, you want to go a completely different direction. You don't need to change the strings at all, and instead should do something more like this:
Dim myString As String = "'OA'Nel'Test, John; random's t'est'"
'This can be const, because it won't ever change
Const SQL As String = " ... WHERE SomeColumn = @myString"
'This is just one way to talk to db, but faster for showing the example
Using cn As New SqlConnection("connection string"), _
cmd As New SqlCommand(SQL, cn)
' This connects the value in your string variable to the @myString placeholder
cmd.Parameters.Add("@myString", SqlDbType.NVarChar, 50).Value = myString
' Open the connection and run the query
cn.Open()
cmd.Execute...()
End Using
Note at no time in the above code (even on the DB server) is the content of myString
ever substituted into the SQL statement. The two are kept completely separate throughout, so no possibility of injection exists.
As a bonus, the database can cache the execution plan, which means you can also often get faster DB responses (it doesn't have to rebuild that part each time), and saves work and memory building new strings on the client.
This is one of a few things that's too important to do wrong even for practice, learning, and proof of concept code.