passing data between forms?

sullyman

Active member
Joined
Nov 11, 2009
Messages
37
Programming Experience
Beginner
I have a gridview on a form pulling user data. I have also created a basic login system where users login and their username/password is checked against a table in SQL Server 2005.

The gridview is on Form 2 but i am having great difficulty in returning the records in the gridview for the user that is currently logged in.

How can i pass the user logged in value to the gridview to only return the logged in user records only.

Please help as i am lost
 
I created a module to collect the user input (Well chuffed with myself :D )

and on form 2, i can get a textbox to fill with the current logged on user by typing in the on load of form 2, tb3.Text = VerifyUser(tb3.Text)

How can i now get the dataset in the gridview to search for records for that username only. The username is contained within the dataset. Any ideas please

Module
Public Function VerifyUser(ByVal user As String) As String
user = Loginform.txtusername.Text
Return user
End Function
 
My Select in the tableadaptor xsd file is the following:

SELECT EmployeeID, EHS_Courseid, Uname
FROM View_3
WHERE (Uname = @Uname)

And i have modified the following on my form but it doesn't work. Any ideas?

Me.View_3TableAdapter.Fill(Me.V3dataset.View_3, "%" & tb3.Text & "%")
 
:D I managed to solve it, happy days

Dim Uname As String
Uname = VerifyUser(tb3.Text)

Me.View_3TableAdapter.Fill(Me.V3dataset.View_3, Uname)
 
Back
Top