Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Where in Winform to load this data
Message
De
14/03/2003 00:15:22
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Divers
Thread ID:
00765705
Message ID:
00765722
Vues:
17
You should get the data in the constructor of the Form instead of the Load (I'm not sure what the VB equivalent is).

~~Bonnie


>I created a sub LoadLookUps() and put this code in it. Then from the Form_load I put LoadLookUps(). But it never loaded my drop down. But if I Put a button on the form, and it calls LoadLookUps() then it works fine. I'm missing something small I think.
>
>Thanks for any help.
>
>
>   Private Sub LoadLookUps()
>        'Create a Connection
>        Dim oConn As System.Data.OleDb.OleDbConnection
>        Dim oCommand As New OleDbCommand()
>
>        oCommand.CommandText = "ct_lu_AuthorizedDeptsByUsers"
>        oCommand.CommandType = CommandType.StoredProcedure
>
>        'Create a new parameter and add it to the parameters collection
>        Dim oParam1 As New OleDbParameter("@tiUserID", OleDb.OleDbType.Integer)
>        oParam1.Value = gnUserID
>        oCommand.Parameters.Add(oParam1)
>        'Connect to Database
>        oConn = SqlConnect(gcConnString)
>        oCommand.Connection = oConn
>        Dim goView As New Data.DataView()
>        'Load the DataView
>        goView = VFPToolkit.vfpData.SqlExecute(oConn, oCommand, "Departments")
>        If VFPToolkit.files.File("C:\dev.cqi") Then
>            VFPToolkit.vfpData.Browse(goView)
>        End If
>        Me.ComboBox1.DataSource = goView
>        Me.ComboBox1.DisplayMember = "deptdesc"
>        Me.ComboBox1.ValueMember = "deptid"
>
>    End Sub
>
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform