Hi guys,
It's my first post so forgive me if I've posted under the wrong section. Well, I just picked up VB.NET and was given a project and I'm stuck.
This is what I am suppose to create :

A number guessing game where 4 numbers will be randomly generated, and the player has to input any 4 random numbers 0 - 9. The text box will then show what numbers the player entered. "X" means wrong, "0" means correct and "P" means wrong position. Message box comes out, indicating the number of guesses the player took when he wins.
And this is what I've been doing until :

I have no idea how to position the "X", "0" and "P" into the text box when the numbers the player used matches the ones the computer generated. Tried Google and stuffs but nothing works. Any kind souls willing to help? Any help will be deeply appreciated! :rapture: My codes are below :




It's my first post so forgive me if I've posted under the wrong section. Well, I just picked up VB.NET and was given a project and I'm stuck.
This is what I am suppose to create :

A number guessing game where 4 numbers will be randomly generated, and the player has to input any 4 random numbers 0 - 9. The text box will then show what numbers the player entered. "X" means wrong, "0" means correct and "P" means wrong position. Message box comes out, indicating the number of guesses the player took when he wins.
And this is what I've been doing until :

I have no idea how to position the "X", "0" and "P" into the text box when the numbers the player used matches the ones the computer generated. Tried Google and stuffs but nothing works. Any kind souls willing to help? Any help will be deeply appreciated! :rapture: My codes are below :
Public Class frmGuessingGame
' Declaration
Dim randomGenerator As New Random
Dim strInputValue As Integer
Dim strSummary As String
Dim intNum1, intNum2, intNum3, intNum4 As Integer
Dim X As String
Dim O As String
Dim P As String
Private Sub frmGuessingGame_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
' Random number generator
Randomize()
' Box 1
intNum1 = CStr(Int(Rnd() * 10))
txtBoxNo1.Text = intNum1
' Box 2
intNum2 = CStr(Int(Rnd() * 10))
txtBoxNo2.Text = intNum2
' Box 3
intNum3 = CStr(Int(Rnd() * 10))
txtBoxNo3.Text = intNum3
' Box 4
intNum4 = CStr(Int(Rnd() * 10))
txtBoxNo4.Text = intNum4
strSummary = "Numbers Entered : " + " 1st " + " 2nd " + " 3rd " + " 4th " + ControlChars.CrLf
End Sub
Private Sub btnGo_Click(sender As System.Object, e As System.EventArgs) Handles btnGo.Click
' Input value entered by player
If IsNumeric(txtBoxInputVal.Text) = False Then
MsgBox("Error: Input value must be a number", MsgBoxStyle.Critical, "Error Message")
Exit Sub
End If
If intNum1 = 1 Then
End If
End Sub
End Class



