Link to home
Start Free TrialLog in
Avatar of VRTech
VRTech

asked on

ComboBox Selection on Form1 to fill dataset on Form2

How do I get the results from a combo box on form1 to be used in a query that populates the dataset on form2?  VB2005.
Avatar of JPERKS1985
JPERKS1985

Dim F1 As New Form2
F1.PassLoginData(EstrUser, EstrPW, AppSession)
Application.Run(F1)



Put this function in Form2

    Public Function PassLoginData(ByVal Usr As String, ByVal PW As String, ByVal Session As String)
        eUsr = Usr
        ePW = PW
        eSession = Session
    End Function

Define these in declarations on form2


    Dim eUsr As String
    Dim ePW As String
    Dim eSession As String

You'll just have to remove some of these strings and adapt it to work with the combobox, but thats how you can pass values between forms.
Avatar of VRTech

ASKER

OK, so I'm creating a function on Form1 that passes values to a function residing on Form2.  The values being passed are derived from my combo box (cboLastName.displayMember) and associated txt field (txtManagerID).  The function in Form2 then passes the values received to a SQLCommand (Select * from tblManagers where ManagerID = @ManagerID) to populate a dataset.  Is that about right?
Looks good, I'm not much for SQL, however that is the method I use to pass data from my login form to another form in my application. So it should work for your purpose aswell.
Avatar of VRTech

ASKER

what are you validating the users password against?  isn't it a value in a table in your database?  What are you using besides SQL?
Well its validating with a php script that does use sql using a http request.
So vb.net is not connecting to the sql directly.
ASKER CERTIFIED SOLUTION
Avatar of JPERKS1985
JPERKS1985

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of VRTech

ASKER

I'm going to code it.  I'll let you know how it comes out.  Thanks.
any luck?
Avatar of VRTech

ASKER

Still working on it.  
Avatar of Bob Learned
I will leave the following recommendation for this question in the Cleanup topic area:
   Accept: JPERKS1985 {http:#18098283}

Any objections should be posted here in the next 4 days. After that time, the question will be closed.

TheLearnedOne
EE Cleanup Volunteer