loggin

I created a loggin form and dont know how to do the loggin databases so i figured id code the loggins. but it doesnt work can u help me with this or say how to do the databases

If (UsernameTextBox.Text = "Loggin" & PasswordTextBox.Text = "Password") Then

Dim openform1 As Form1 = New Form1

openform1.ShowDialog()

End If

End Sub




Answer this question

loggin

  • RobertC..!

    does the express version have this

  • Chris Du

    as you learn more you can start to look at code and figure out the problem easier i guess you could say

  • OPL

    Ok well i set the code to

    If (UsernameTextBox.Text = "Loggin" And PasswordTextBox.Text = "Password") Then

                                                            ^

                                                         with and

    and then i made it to where if UsernameTextBox.Text = "Loggin" aswell as the password = "password" then it would MsgBox("loggin correct"), it doesnt bring up an error or anything but it doesnt display the text instead it just exits The loggin form

     

    Does the fact that

    Private Sub Login_Load //its in here

    matter



  • Chris0144

    thx for the help though, i couldnt haev figured it out without the And thing, thx again spotty =P

  • James_N

    Its really simple

    Use

    If (UsernameTextBox.Text = "Loggin" AND PasswordTextBox.Text = "Password") Then

    and not

    If (UsernameTextBox.Text = "Loggin" & PasswordTextBox.Text = "Password") Then


    Use of the & in this scenario is wrong & is string contatenation and therefor I would expecte something like an invalid cast exception.

    Otherwise your doing a string comparison which will give you a true of false

    UsernameTextBox.Text = "Loggin" = True / False

    PasswordTextBox.Text = "Password") = True / False

    and then trying to do string concatenation on two booleans. Which is invalid.


  • Jed

    well you see.

    The debugger says the code is fine unti you enter the loggin form, my program starts on a Form1, then you cilck a button to go to Loginform and then it stops responding.



  • farproc2000

    If (UsernameTextBox.Text = "Loggin" & PasswordTextBox.Text = "Password") Then

    has the error on it



  • Ertan Köseler

    Glad you got it sorted....

    Try to include where your calling the code from as well. ie. If its in a form load include the whole sub..... end sub. That way we'll also be able to see where your trying to call it from which is often part of the problem.

    But glad your sorted on this....


  • Billl

    This statement My.Computer.Audio.Play will only play wav files.

    In order to play mp3's there are a number of ways - one would be to use the Windows Media Player object.

    Do a quick search on this forum or the VB General Forum on MP3 and you'll see a number of solutions to the problem.

     http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=54447&SiteID=1


  • Triple B

    The debugger does not tell you the code is fine. You set a break point with F9 and if you're running in debug mode, the code stops there and you can go through one step at a time. If your app is freezing, it seems likely to me that the other form is being created, and causing the problem somehow.

    Please set a breakpoint and step through to work out if thise code is executing, and on what line it freezes.



  • Tirrell

    Thats true - the more you use it the more you know where to look for answers as well.


  • AndyLee71

    sweet, nvm i figgured it out this time actually, i have to have it in the sub

    Private Sub OK_Click()



  • ChangLuo

    Probly gona make my own music player, but i have a few questions, can you play .mp3s and not just wavs and is this a valid code for input

    Private Sub Button2_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

    My.Computer.Audio.Play("C:/Program Files/BA-92/Music" & TextBox3.Text)

    End Sub



  • micropterus_sal

    Hi.

    I'm not sure what & does in VB, I thought you needed to use 'and'. However, overall, this looks to me like I'd expect it to work. Have you stepped through the debugger to see what's going wrong What is happening

    www.codeproject.com has lots of articles, you'd find info there on how to connect to a database. This is obviously not secure, anyone can use reflector to find out what the username/password are.



  • loggin