Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Visual basic question. need help !

Options
  • 26-01-2013 5:49pm
    #1
    Registered Users Posts: 363 ✭✭


    im using visual basic 2010 edition im making a program that lets a user place up to 10 order's for new computers (College project) .

    Ok il explain what i have done.Main form I have The username/password set up to accept 2 usernames/passwords as thats all i want for now.
    I have a remember me check box set up and quit button done. I also have a group box that isnt coded yet.

    Now what i want to be able to do is to code the login button so that :
    (1) if someone types in the wrong password/username a pop up appears saying password/username invalid.
    (2) I want everything to be hidden once the person logges in.
    (3) Group box on the main form this is going to be hidden so that when the person logges in it becomes unhidden all while its on the main form to keep from taking too long to load.
    (4) i also have a timer added to group box to show date and time which i also have to have the user's username appear in the group box straight from txtUsername.

    Will update!
    Code so far :
    Public Class frmMain

    Private Sub frmMain_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
    If chkRemember.Checked = True Then 'If remember me box is checked then Username + password will be saved When ending program.
    My.Settings.Username = txtUsername.Text
    My.Settings.password = txtPassword.Text
    Else
    My.Settings.Username = "" 'If remember box isnt checked when ending the program then the txt boxes will be cleared
    My.Settings.password = ""
    End If
    End Sub

    Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    txtUsername.Text = My.Settings.Username '
    txtPassword.Text = My.Settings.password
    End Sub

    Private Sub btnQuit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnQuit.Click
    Me.Close() 'Quit = close
    End Sub

    Private Sub btnLogin_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnLogin.Click

    End Sub

    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles timerLogin.Tick
    lblTime.Text = "Time: " + TimeString ' Puts the current time in lbltime
    lblDate.Text = "Date: " + DateString ' puts the current date in lblDate
    End Sub
    End Class
    Will add more.
    Screenshot:
    softwareo.jpg


Comments

  • Registered Users Posts: 7,157 ✭✭✭srsly78


    something.visible = false

    and

    something.visible = true

    To pop up a message box with options just go:

    MsgBox "blah blah", OPTION_QUIT

    or something like that, read the documentation: http://msdn.microsoft.com/en-us/library/139z2azd(v=vs.90).aspx (see example section)

    Would also help if you said what kind of VB you are talking about.


  • Registered Users Posts: 363 ✭✭bernardamaac.


    "something.visible = false

    and

    something.visible = true"
    Im guessing i put that in for the login code and put group box.visible.true and say the rest of the stuff visible false ?

    "To pop up a message box with options just go:
    MsgBox "blah blah", OPTION_QUIT"
    should be easy enough this bit im using visual basic 2010 express edition.


  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Have a read of the forum charter and then have a read of this: it will teach you how to ask a question online.


  • Registered Users Posts: 363 ✭✭bernardamaac.


    Evil Phil wrote: »
    Have a read of the forum charter and then have a read of this: it will teach you how to ask a question online.

    Ok il re-write my question the way you want.


  • Registered Users Posts: 7,157 ✭✭✭srsly78


    1. Call MsgBox in login event.

    2. stuff.visible = false (once login event succeeds)

    3. groupbox.visible = true (once login event succeeds)

    4. userlabel.visible = false (on startup), userlabel.visible =true (once login event succeeds)


  • Advertisement
  • Registered Users Posts: 363 ✭✭bernardamaac.


    Ya i got all that done awhile ago thanks for the help. If i need some help with more of it later on during the week with other parts of the project will i post a new thread or update this one ?


  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    Ya i got all that done awhile ago thanks for the help. If i need some help with more of it later on during the week with other parts of the project will i post a new thread or update this one ?

    New thread if its a different issue.


Advertisement