Hi every one,
I am getting the following error "COM object that has been separated from its RCW cannot be used"
private void BtnNew_Click(object sender, EventArgs e)
{
TxtBx.Text = string.Empty;
axAcroPDF1.Dispose();
scancontinue = false;
num = 0;
}
private void BtnSave_Click(object sender, EventArgs e)
{
// PnlGeneral.Visible = false;
{
BtnScan.Enabled = true;
if (Isvalid())
{
SqlCommand cmd = new SqlCommand("sp_GenDocuments", con);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.AddWithValue("@DocName", TxtBx.Text);
cmd.Parameters.AddWithValue("@DateCreated", Dtpc.Text);
cmd.Parameters.AddWithValue("@DocLocation", paths);
//cmd.Parameters.AddWithValue("@DocLocation", path);
cmd.Parameters.AddWithValue("@UserName", Login.currentuser);
cmd.Parameters.AddWithValue("@imgno", popuprds.noRecord);
if (con.State != ConnectionState.Open)
con.Open();
int i = cmd.ExecuteNonQuery();
if (i > 0)
{
MessageBox.Show("Record inserted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
axAcroPDF1.LoadFile(paths); --------> I am getting error here when i tried to load the pdf for second time
}
else
{
MessageBox.Show("Record not inserted", "Message", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
}
}
North America
Europe, Middle East and Africa
Asia Pacific