Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Load Method - Explain Help statement
Message
De
14/03/2003 10:14:53
 
Information générale
Forum:
ASP.NET
Catégorie:
Formulaires
Divers
Thread ID:
00765828
Message ID:
00765856
Vues:
16
This message has been marked as the solution to the initial question of the thread.
The Sub New() is in the Windows Form Designer generated code. Just add a call to your sub LoadLookups into the New() sub after the InitializeComponent().

~~Bonnie


>Here is my problem (VB.net). I have a form and I want to load the data during the form load event. I initially I built the code into a button, so the form loaded, I clicked the button and then my combobox had all the data. Now I want that code to run without having to push a button. So I moved the code into the Load and nothing happened, not even an error. I created a sub and called it from the load, nothing happened. I put the code back into a button then it worked. When all else fails, read the help...so I did. It shows a walkthrough of loading data to a datagrid BUT FROM A BUTTON also. At the bottom it say:
>
>
>*  Make the grid display data without being explicitly loaded by the user. 
To do this, you add a Fill method to the form's New method (in Visual Basic)
 or constructor (in C#) and remove the Load button
>
>
>Does it show you how? No. So I think I need to add a fill method to the form's New Method? Can somebody help me?
>I don't see the New method in the IDE.
>
>
>Below is the code I'm currently using in the button:
>
>Thanks
>
>
>   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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform