How to use BackGroundWorker in C #

I have a question.
I would like to use the backgroundworker in my application, but I do not know how to do it. My application takes a long time to perform some validations, which is frozen. The idea that I have is to put a button CANCEL VALIDATION. How could I do it?
This is my code, here the whole process is finished.

        empty list ()
{
try
{
CN_Guides guides = new CN_Guias ();
DateTime Today = DateTime.Today;
string current_date = Today.ToString ("dd / mm / yyyy");
chain month, year;
month = txt_mes.Text;
year = txt_anno.Text;
if (txt_ruta.Text == "")
{
MessageBox.Show ("Enter the route please. !!!", "Enter data", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
else if (txt_mes.Text == "")
{
MessageBox.Show ("Enter the month please. !!!", "Enter the data", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
otherwise if (txt_anno.Text == "")
{
MessageBox.Show ("Enter the year please. !!!", "Enter data", MessageBoxButtons.OK, MessageBoxIcon.Warning);
}
if not
{
DataTable dtImagenes =
guias.Listar_Guias_xMes_xYear (Convert.ToInt32 (month),
Convert.ToInt32 (year));
int amount_imagen_db = dtImages.Rows.Count;
pgb_loading.Visible = true;
pgb_loading.Maximum = quantity_imagen_db;
pgb_loading.Step = 1;
pgb_loading.Value = 0;

// HOME FOR
btn_listar.Enabled = false;
txt_mes.Enabled = false;
txt_anno.Enabled = false;
foreach (DataRow line in dtImagenes.Rows)
{
string idagename_db = row["NroGuia"].ToString (). TrimEnd (& # 39;);
string[] files = Directory.GetFiles (txt_ruta.Text, idagen_name + ". *");
string[] files2 = Directory.GetFiles (txt_ruta.Text, idagen_name + "_ *");
if (pgb_loading.Value <= amount_imagen_db)
{
pgb_loading.PerformStep ();
}
if (files.Length == 0 && archivos2.Length == 0) {
string f_guia = row["FechaGuia"].ToString ();
guides.InsertGuidesValidadas (db_imagen_name,
Convert.ToDateTime (f_guia),
DateTime.Now, "NO");
}
}
MessageBox.Show ("The validation was successful");
btn_listar.Enabled = true;
txt_mes.Enabled = true;
txt_anno.Enabled = true;
Clean ();
// END FOR
//btn_validar.Enabled = true;
}
}
catch (Exception ex)
{
MessageBox.Show (ex.Message.ToString ());
}
}

I hope you can help me. Thank you

Image validation form