Hi, I'm just a junior in VB.NET so please be patient.
I have an AccesDatabase that contains more then 900.000 records. In the Form_Load event these records are loaded into a combobox. This takes about 10 seconds. Sometimes more, sometimes less. To make the waiting for the user less boring I want to show a ProgressBar while loading the data to the Combo. Searched a long time on the internet, but can't find a good tutorial for a beginner anywhere. (not even here) I hope one of you guys could help me out.
The code I use to connect to the database:
How and where do I implement the ProgressBar? Perhaps I need to code another way. I'm not using "Main".
I have an AccesDatabase that contains more then 900.000 records. In the Form_Load event these records are loaded into a combobox. This takes about 10 seconds. Sometimes more, sometimes less. To make the waiting for the user less boring I want to show a ProgressBar while loading the data to the Combo. Searched a long time on the internet, but can't find a good tutorial for a beginner anywhere. (not even here) I hope one of you guys could help me out.
The code I use to connect to the database:
Code:
Imports System.Data.OleDb
How do I implement the ProgressBar?
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim ConnectionString As String
Dim DbConnection As OleDbConnection
Dim DbCommand As OleDbCommand
Dim DbDataReader As OleDbDataReader
Try
ConnectionString = _
"Provider = Microsoft.Jet.OLEDB.4.0;" & _
"Data Source = C:\test.mdb; Mode = Read;" & _
"Persist Security Info = False"
DbConnection = New OleDbConnection(ConnectionString)
DbConnection.Open()
DbCommandPlaats = New OleDbCommand("SELECT DISTINCT Field1 FROM TABLE", DbConnection)
DbDataReaderPlaats = DbCommandPlaats.ExecuteReader
Do While DbDataReaderPlaats.Read
ComboBox1.Items.Add(DbDataReaderPlaats("PLAATS"))
Loop
DbDataReaderPlaats.Close()
How and where do I implement the ProgressBar? Perhaps I need to code another way. I'm not using "Main".