I was wondering how can i make a working login form
What have i to put for user nae and password
Thanks in advanced
Mark
Are you storing the login credentials in database ?
here.. i have some script for login form ..
Private Sub ButtonX1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ButtonX1.Click
connection()
Try
strcmd = New SqlClient.SqlCommand
strcmd.Connection = koneksi
strcmd.CommandText = "select * from tbl_user where ID = '" & t_id.Text & "' and password = '" & t_pass.Text & "'"
login.DataSource = strcmd.ExecuteReader()
If login.Count > 0 Then
MessageBox.Show("Login success ..!)
mainform.Show()
t_id.Text = ""
t_pass.Text = ""
Me.Hide()
Else
MessageBox.Show("wrong username or passwd!")
End If
Catch ex As Exception
MessageBox.Show("System Information", "error occurs on filling the username and password")
End Try
End Sub
submit this code in a command object ..
you can try .. :)
koneksi.Open() 'open connection to server
strcmd = New SqlClient.SqlCommand
strcmd.Connection = koneksi
'this is the SQL select statement query that is performed
' to read the username and password from server
strcmd.CommandText = "select * from tbl_user where ID = '" & t_id.Text & "' and password = '" & t_pass.Text & "'"
Dim reader As SqlDataReader = strcmd.ExecuteReader
If reader.Read Then
frmMain.Show'Display Application Main Form
Me.Dsipose 'use dispose instead of hide so you can clear all login form resources from memory
Else
MessageBox.Show("invalid username or Password")
End if
actually no i dont have database because i dont know how to make one but how can i make a txt file as a database?
please answer meeee
or tell me how to make a database
i have a login form by fa3hed but i need a database please
Which database you plan to use ?
What ever the database is , create a table to store user_id, password and other required information.
ok look i have xammp how can i do a database for a forum please i have myBB
if you can tell me a tutorial site on how to do your own Forum then i can mark this topic as solved .
Thanks
ok look i have xammp how can i do a database for a forum please i have myBB
if you can tell me a tutorial site on how to do your own Forum then i can mark this topic as solved .Thanks
I think debasisdas has given you the right answer. You need a plan to know the database you want to make use of and what you're good at. Any other thing requires further reading
i have done a forum but how can i find the database i need to use it with navicat but can really do it
i have done a forum but how can i find the database i need to use it with navicat but can really do it
Google it, there are tons of information about Databases..
You will never find any database online that caters to your exact requirement. So you need to design your own DB. Ans so far as log in concerned create a table to store user_id, password and other required information.You need to check for existence of userid/ password in the database. If it exists log in successful and allow the user to proceed further.
xampp has phpmyadmin, you can use it as a database..
db.mdb this file was in the fa3hry's login form i have all the tables the admins one and the users one now how can i make such file like db.mdb with the tables that i have ??
i have files saved in database.sql
Tell me first which data base you are using.
Is it MySQL or Ms Access ?
MySQL
what is that .mdb file you have mentioned ?
http://www.daniweb.com/software-development/vbnet/threads/369800 here fa3hry has attached a file which containes all the important login forms in vb and he has a file called database.mdb in which this one has all the information of his forum .
Even if he can, he needs to learn how to create a dbase himself.
Very true...
MarkGia,
The easiest way I've found to do a login form with a database is using SQL Server 2008 Express with Management Studio and creating a table called users and then using a datareader to see if the table contains rows that match what a user is trying to use. If you need any help with this just let me know and I will give you a complete walkthrough.
Here's something using a .txt file.
codeorder:myCoolPassword
Save that text or any text in a file, mine is "C:\loginCredentials.txt".
Make sure you separate the username and password with a ":".
And for the code, see if this helps.
1 Button, 2 TextBoxes
Public Class Form1
Private myLoginCredentialsFile As String = "C:\loginCredentials.txt"
Private myFileContent As String = Nothing
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
If IO.File.Exists(myLoginCredentialsFile) Then myFileContent = IO.File.ReadAllText(myLoginCredentialsFile) '// load File.
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text Like myFileContent.Substring(0, myFileContent.IndexOf(":")) Then '// check username.
If TextBox2.Text Like myFileContent.Substring(myFileContent.IndexOf(":") + 1) Then '// check password.
Else
MsgBox("incorrect password")
Exit Sub
End If
Else
MsgBox("incorrect username")
Exit Sub
End If
MsgBox("Login Successful")
End Sub
End Class
thanks for this code codeorder im gonna study each line
thanks
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.