I am writing an import utility that needs to display information durring the import process.
When the Import button (Button2) is clicked, the form should disable several of the input controls, and show a messages that says "Import Started". When finished importing it should say "Import Finished", and then reenable the controls.
Instead, what is happening is there are no updates to the form until the Button2_Click sub is finished. The result is that the form never says "Import Started" during the import. The form becomes unresponsive durring the import process and then shows "Import Finished" when it is finsihed.
Any idea why it is doing this?
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Enabled = False
TextBox2.Enabled = False
Button1.Enabled = False
Button2.Enabled = False
Label3.Text = "Import Started"
ImportData(TextBox1.Text, TextBox2.Text)
Label3.Text = "Import Finished"
TextBox1.Enabled = True
TextBox2.Enabled = True
Button1.Enabled = True
Button2.Enabled = True
End Sub
When the Import button (Button2) is clicked, the form should disable several of the input controls, and show a messages that says "Import Started". When finished importing it should say "Import Finished", and then reenable the controls.
Instead, what is happening is there are no updates to the form until the Button2_Click sub is finished. The result is that the form never says "Import Started" during the import. The form becomes unresponsive durring the import process and then shows "Import Finished" when it is finsihed.
Any idea why it is doing this?
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
TextBox1.Enabled = False
TextBox2.Enabled = False
Button1.Enabled = False
Button2.Enabled = False
Label3.Text = "Import Started"
ImportData(TextBox1.Text, TextBox2.Text)
Label3.Text = "Import Finished"
TextBox1.Enabled = True
TextBox2.Enabled = True
Button1.Enabled = True
Button2.Enabled = True
End Sub