hello all,
I'm currently developing an app for mobile device.
at form load my app execute a query to populate the the dropdown box with a distinct values from 3600 records unfortunately it takes a while for the form to load it looks like its freezing for a few minutes. is there a way to query the 3600 records for distinct value in a fast way.
here is my code.
at form load it will call the functions getpartslist to get the unique values in the [assembly] fields
I'm doing this right? please let me knowCode:Private Sub frmBranding_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim c As Integer = 0 Dim count As Integer = GetPartsList.Count - 1 cboParts.Items.Clear() For c = 0 To count cboParts.Items.Add(GetPartsList.Item(c)) ' will loop to the rest of the records and populate the combo box. Next End Sub Public Function GetPartsList() As List(Of String) Dim parts As New List(Of String) Dim rs As New SqlCeDataAdapter("SELECT DISTINCT([ASSEMBLY]) as [PartName] FROM Parts", DBconnExt) Dim dt As New DataSet Dim c As Integer = 0 rs.Fill(dt, "Ass_List") If dt.Tables("Ass_List").Rows.Count <> 0 Then For c = 0 To dt.Tables("Ass_List").Rows.Count - 1 parts.Add(dt.Tables("Ass_List").Rows(c).Item("PartName")) Next End If Return parts End Function
thank you.


Reply With Quote
