Hi, am working on my assignment, i wanted to know whether there could be a way in which if i click on sign in on my vb.net button, i could get a pop up or a dialog style message asking me for the username and password. Is there any way or any possibility of carrying out such kind of technique. Please help me with info on how to do it and the codes. Thanks.

Yes, there is.
This is a quick sample of how to accomplish that.

This is the button click.

Private Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
   Dim login As LoginReturnCodes
   Dim lif As New LoginForm()
   If lif.ShowDialog() = DialogResult.OK Then
      login = lif.Success
   End If

   If login = LoginReturnCodes.Success Then
      'Do some coding for successful login
   ElseIf login = LoginReturnCodes.Failure Then
      MessageBox.Show("Login failed. Please try again.")
      'Do nothing
   End If
End Sub

Assuming that you already have a form in place for username and password, with a Login button and a Cancel button.
For the form, set the property AcceptButton to the Login button, and the property CancelButton to your Cancel button.
This is code for the login form.

Public Enum LoginReturnCodes
   Success = 0
   Failure = 1
End Enum

Public Class LoginForm
   Private _success As LoginReturnCodes

   Private Sub btnLogin_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnLogin.Click
      'Do some checking if username and password are valid
      'If valid, set _success to LoginReturnCodes.Success
      'If not valid, set _success to LoginReturnCodes.Failure

   End Sub

   Private Sub btnCancel_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnCancel.Click
   End Sub

   Public ReadOnly Property Success() As LoginReturnCodes
         Return _success
      End Get
   End Property
End Class

*accidental double post*

hi its giving me an error : LoginReturnCode not defined what should i do

On what line is the error thrown?
Did you add the Public Enum outside the class definition?

*accidental double post*

Hey its ok thanks, it worked i was just making a spelling mistake, sorry and thankyou

You're welcome. :)
Please mark the thread as solved if this has been helpful.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.18 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.