Hello guys,
I am doing a project.I have used Microsoft access as my database.I have created register table with first name, last name, username and password. I have inserted username and password from register table to new table named as login table.After logging in with username and password i should get the welcome message in new form saying welcome first name.
For example, if your first name is "xyz". Then the new form should show "welcome xyz".
For that i dragged 2 labels one for welcome and other for first name. Will u please help me with the code and database connection for first name thanks in advance.

Recommended Answers

All 6 Replies

ok Happyns

I will guide you through easy way, by the way there are number of ways to do that.

1. assume you login formname is frmlogin and welcome screen form name is frmMain,
label1 name is lblwelcom and label2 name is lblFname, in loginform textbox1 name is txtuser and textbox2.name=txtlname, now goto load method of welcome screen,

and write down.

me.lblfname.text= frmlogin.txtuser.text

and you will have that name shown on welcome screen.

Take Care if anything let me know..

hey dude thanks a lot for ur reply. The thing i asked is in this way
In database in register table i stored the following
Firstname abc
Lastname xyz
Username hello
Password hi
From register table i have inserted Username and Password to Login table. So Login table database consists of the following
Username hello
Password hi
Now after connecting to database writing the code and the execution starts.

Login form
Username hello
Password hi
(After this i am able to go to welcome form but it should display saying as follows)

Welcome abc
I hope that you got my point.

Ok, I am sorry, ok
I will give you code by tomorrow morning.

hey dude thanks a lot for ur reply. The thing i asked is in this way
In database in register table i stored the following
Firstname abc
Lastname xyz
Username hello
Password hi
From register table i have inserted Username and Password to Login table. So Login table database consists of the following
Username hello
Password hi
Now after connecting to database writing the code and the execution starts.

Login form
Username hello
Password hi
(After this i am able to go to welcome form but it should display saying as follows)

Welcome abc
I hope that you got my point.

what is your effort to do this??where is your attempt?so u want people do your work..

thanx for co-operation alekhan

hey happyns,
on Form_Load event you need to code,
code is as follow,

Dim odaCom As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("Select * from CompanyInfo", My.Settings.SecurityConnectionString1)
' my.settings.securityConnectionString is automated created string,u need to change and ' provide provider or you can also create a dataset from wizard i hope u know all 'thses basics.

'here declare new datatable and fill adapter with data.
Dim dtCom As DataTable = New DataTable()
Try
odaCom.Fill(dtCom)
'here i am using list box you can use textbox.text
'for instance me.txtname.datasource=dtcom
'me.txtname.text="First Name"
Me.ListBox1.DataSource = dtCom
Me.ListBox1.DisplayMember = "Company"
Me.ListBox1.ValueMember = "Company"

Catch ex As Exception

End Try

''' I hope it will work fine.... Take Care....

Be a part of the DaniWeb community

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