Welcome to HBH! If you had an account on hellboundhacker.org you will need to reset your password using the Lost Password system before you will be able to login.

VB Little Help...


ghost's Avatar
0 0

Hey, I dont really know that much VB but I am having a little problem….

As far as i know this is correct

Private Sub txtUser_Change(Index As Integer)
    txtUser.Text = "hi"
End Sub```

txtUser is an input field...

What I was trying to do is when someone typed anything in it. that it would change the text to hi

I have also tried things like...

```markupIf txtUser.Text = "bah" Then```

But gives me a compiling error when it gets to it...


```markupPrivate Sub cmdTest_Click()
    If txtUser.Text = "test" Then
        If txtPass.Text = "test" Then
            txtCor.Text = "Username, Password correct."
        Else
            txtCor.Text = "Password is incorrect.
        End If
    Else
        txtCor.Text = "Username Incorrect.."
    End If
End Sub```

I am sure im doing this wrong. Just need a little help. Havnt searched google but just thought I would post it here also.



/// Edit

All I can find on google is what i am trying. Which is .Text

ghost's Avatar
0 0

You mean something other than a missing quote?


ghost's Avatar
0 0

This line markupPrivate Sub txtUser_Change(Index As Integer) makes me think you made it a control array, so you should do

txtUser(Index).Text = "hi"

And also, could you specify the compiling error you get?


ghost's Avatar
0 0

Yea i accidently made it an array…. :P dont copy and paste input fields in visual basic :)