I want to make a random function here, so when i press Button3 it's gonna replace the number "star.9902" to a completely new random number, Without replace the text "star." and then show up in Textbox1. But right now everything is getting replaced including the text.
I'm pretty new to coding so it would be great if you guys can help me out. vb13.
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If TextBox1.Text.Contains("star.9902") Then
TextBox1.Text = TextBox1.Text.Replace("star.9902", "star. 'Here goes the random numbers")
End If
Dim rand As New Random
Dim letter As String = ""
For i = 0 To 3
letter = letter & ChrW(rand.Next(Asc("0"), Asc("9") + 1))
Next
TextBox1.Text = letter
End Sub