Question :
I’m creating an application with Firebird 2.5
in which I need it to read a .sql
file with instructions to populate the database if these processes have not yet been done, because it is a bit long and because I do not know I want to add "não respondendo"
to ProgressBar
, but when I add them I’m now getting the following error while executing the commands: BackgroundWorker
. Now if I run the application without using Connection must be valid and open
and ProgressBar
this error does not occur. This is the code I’m working on and the image on the screen is working, and it comes to an end without making a mistake. I’ve relied on this example of DevMedia: link
using System;
using System.Data;
using System.Windows.Forms;
using Engebuilder.Library;
using Engebuilder.UI.Windows.General;
using Engebuilder.UI;
using Engebuilder.Data;
using System.Reflection;
using System.Drawing;
using System.IO;
using System.Text.RegularExpressions;
using System.Threading;
using System.Text;
namespace GSD
{
public partial class FomAux : Engebuilder.UI.Windows.General.DefaultForm
{
System.Windows.Forms.Timer timer = new System.Windows.Forms.Timer();
public FomAux()
{
this.InitializeComponent();
this.SetComponents(components);
}
private void FomAux_Load(object sender, System.EventArgs e)
{
timer.Interval = 10;
timer.Enabled = true;
timer.Tick += new EventHandler(Timer_Tick);
}
int contador = 0;
private void Timer_Tick(object sender, System.EventArgs e)
{
try
{
contador += 1;
if (contador >= 5)
{
timer.Enabled = false;
contador = 0;
backgroundWorkerPopularBanco.RunWorkerAsync();
}
}
catch (Exception ex)
{
MessageBox.Show("Ocorreu um erro inesperado: "" + ex.Message + """""", ""Atenção!"", MessageBoxButtons.OK, MessageBoxIcon.Information)
Answer :