Hello: I have a .net windows app created using 2005.
one of my forms is taking longer than i would like to load.
when it loads, I call numerous subroutines that go to the web server via a web services to get data from the database that also resides there....to populate all the drop downs on the form:
Here's a code example for one of them....they pretty much all look similar:Code:Private Sub LogJobs_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Call PopulateCustomers() Call PopulateContacts() Call PopulateTerritory() Call PopulateSales() Call PopulateComments() Call PopulateSignName() end Sub
I was thining perhaps it would be better to make one trip to the server and get a list of datatables to return with.Code:Public Sub PopulateTerritory() If IsNothing(tblLookupTerritory) Then Dim oService As New SloanLEDEstimator_WebService.Service tblLookupTerritory = oService.PopulateTerritory() End If Try If tblLookupTerritory.Rows.Count >= 1 Then With cboTerritory .DataSource = tblLookupTerritory .DisplayMember = "Territory" .ValueMember = "Territoryid" End With cboTerritory.SelectedItem = 1 End If Catch MsgBox("An error occurred in PopulateTerritory " & sql) End Try End Sub
Do you think this is the better way to deal with this?
Thanks,
Proctor




Reply With Quote