First of Hi peeps .... I have a small prob that I want to run by anyone who could help me simplify this code, Well I'm trying to change the string value (123A456B789) into a numerical value like this '123' 'A=0' '456' 'B=1' '789', but for the same reason as saving the time in writing 50 lines just to incorporate this function I need a quicker solution...
Here's my code but bare in mind I am still new at VB.NET and the code is only to change A and B to numerical values.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click For Each ch As Char In TextBox1.Text If TextBox1.Text.Contains("A") Or TextBox1.Text.Contains("B") Then Dim chA As Char = "A" Dim chB As Char = "B" TextBox2.Text = TextBox1.Text.Replace(chA, Asc(chA)) TextBox2.Text = TextBox2.Text.Replace(chB, Asc(chB)) End If Next End Sub
I hope one of you could show me a quicker yet better way of resolving this issue.