andrewl77
asked on
VS2010 Application Bug
I have an application that has been written for me and i have all the source code. When i compile and run it i get the following error. What can be causing this?
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidCastExceptio n: Unable to cast object of type 'System.Windows.Forms.Tool StripMenuI tem' to type 'System.Windows.Forms.Cont rol'.
at Accusoft.FSInvoicesDemo.MD IParent2.l ocalFolder ToolStripM enuItem_Cl ick(Object sender, EventArgs e)
at System.Windows.Forms.ToolS tripItem.R aiseEvent( Object key, EventArgs e)
at System.Windows.Forms.ToolS tripMenuIt em.OnClick (EventArgs e)
at System.Windows.Forms.ToolS tripItem.H andleClick (EventArgs e)
at System.Windows.Forms.ToolS tripItem.H andleMouse Up(MouseEv entArgs e)
at System.Windows.Forms.ToolS trip.OnMou seUp(Mouse EventArgs mea)
at System.Windows.Forms.ToolS tripDropDo wn.OnMouse Up(MouseEv entArgs mea)
at System.Windows.Forms.Contr ol.WmMouse Up(Message & m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Contr ol.WndProc (Message& m)
at System.Windows.Forms.ToolS trip.WndPr oc(Message & m)
at System.Windows.Forms.ToolS tripDropDo wn.WndProc (Message& m)
at System.Windows.Forms.Nativ eWindow.Ca llback(Int Ptr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso ft.NET/Fra mework64/v 4.0.30319/ mscorlib.d ll
-------------------------- ---------- ----
FSInvoicesDemo
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/FSInvoi cesDemo.ex e
-------------------------- ---------- ----
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2104.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.Windows. Forms/v4.0 _4.0.0.0__ b77a5c5619 34e089/Sys tem.Window s.Forms.dl l
-------------------------- ---------- ----
System
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2103.2 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m/v4.0_4.0 .0.0__b77a 5c561934e0 89/System. dll
-------------------------- ---------- ----
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.Drawing/ v4.0_4.0.0 .0__b03f5f 7f11d50a3a /System.Dr awing.dll
-------------------------- ---------- ----
DBOperation
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/DBOpera tion.DLL
-------------------------- ---------- ----
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.Configur ation/v4.0 _4.0.0.0__ b03f5f7f11 d50a3a/Sys tem.Config uration.dl l
-------------------------- ---------- ----
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.Core/v4. 0_4.0.0.0_ _b77a5c561 934e089/Sy stem.Core. dll
-------------------------- ---------- ----
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.Xml/v4.0 _4.0.0.0__ b77a5c5619 34e089/Sys tem.Xml.dl l
-------------------------- ---------- ----
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ 64/System. Data/v4.0_ 4.0.0.0__b 77a5c56193 4e089/Syst em.Data.dl l
-------------------------- ---------- ----
System.Transactions
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ 64/System. Transactio ns/v4.0_4. 0.0.0__b77 a5c561934e 089/System .Transacti ons.dll
-------------------------- ---------- ----
System.EnterpriseServices
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ 64/System. Enterprise Services/v 4.0_4.0.0. 0__b03f5f7 f11d50a3a/ System.Ent erpriseSer vices.dll
-------------------------- ---------- ----
System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.Numerics /v4.0_4.0. 0.0__b77a5 c561934e08 9/System.N umerics.dl l
-------------------------- ---------- ----
Accusoft.FSInvoices1.Net
Assembly Version: 1.2.0.116
Win32 Version: 1.2.0.116
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/Accusof t.FSInvoic es1.Net.DL L
-------------------------- ---------- ----
Accusoft.FSInvoices1.Net&
Assembly Version: 1.0.0.0
Win32 Version: 1.2.0.116
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/Accusof t.FSInvoic es1.Net.dl l
-------------------------- ---------- ----
System.Runtime.Serializati on
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.Runtime. Serializat ion/v4.0_4 .0.0.0__b7 7a5c561934 e089/Syste m.Runtime. Serializat ion.dll
-------------------------- ---------- ----
SMDiagnostics
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/SMDia gnostics/v 4.0_4.0.0. 0__b77a5c5 61934e089/ SMDiagnost ics.dll
-------------------------- ---------- ----
System.ServiceModel.Intern als
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso ft.Net/ass embly/GAC_ MSIL/Syste m.ServiceM odel.Inter nals/v4.0_ 4.0.0.0__3 1bf3856ad3 64e35/Syst em.Service Model.Inte rnals.dll
-------------------------- ---------- ----
ImageGear20.Formats.Pdf
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Forma ts.Pdf.DLL
-------------------------- ---------- ----
Accusoft.ScanFixXpress7.Ne t
Assembly Version: 7.0.1.1
Win32 Version: 7.0.1.1
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/Accusof t.ScanFixX press7.Net .DLL
-------------------------- ---------- ----
ImageGear20.Core
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Core. DLL
-------------------------- ---------- ----
ImageGear20.Formats.Camera Raw
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Forma ts.CameraR aw.DLL
-------------------------- ---------- ----
ImageGear20.Formats.Common
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Forma ts.Common. DLL
-------------------------- ---------- ----
ImageGear20.Formats.Advanc ed
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Forma ts.Advance d.DLL
-------------------------- ---------- ----
ImageGear20.Formats.Office
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Forma ts.Office. DLL
-------------------------- ---------- ----
ImageGear20.Formats.Vector
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Forma ts.Vector. DLL
-------------------------- ---------- ----
ImageGear20.Presentation
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files /EASYAP/In voiceProce ss/ImageGe ar20.Prese ntation.DL L
-------------------------- ---------- ----
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.InvalidCastExceptio
at Accusoft.FSInvoicesDemo.MD
at System.Windows.Forms.ToolS
at System.Windows.Forms.ToolS
at System.Windows.Forms.ToolS
at System.Windows.Forms.ToolS
at System.Windows.Forms.ToolS
at System.Windows.Forms.ToolS
at System.Windows.Forms.Contr
at System.Windows.Forms.Contr
at System.Windows.Forms.ToolS
at System.Windows.Forms.ToolS
at System.Windows.Forms.Nativ
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso
--------------------------
FSInvoicesDemo
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files
--------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2104.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso
--------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2103.2 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso
--------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
DBOperation
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/Program%20Files
--------------------------
System.Configuration
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso
--------------------------
System.Xml
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso
--------------------------
System.Data
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2102.0 built by: NET47REL1LAST
CodeBase: file:///C:/Windows/Microso
--------------------------
System.Transactions
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
System.EnterpriseServices
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
System.Numerics
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
Accusoft.FSInvoices1.Net
Assembly Version: 1.2.0.116
Win32 Version: 1.2.0.116
CodeBase: file:///C:/Program%20Files
--------------------------
Accusoft.FSInvoices1.Net&
Assembly Version: 1.0.0.0
Win32 Version: 1.2.0.116
CodeBase: file:///C:/Program%20Files
--------------------------
System.Runtime.Serializati
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
SMDiagnostics
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
System.ServiceModel.Intern
Assembly Version: 4.0.0.0
Win32 Version: 4.7.2046.0 built by: NET47REL1
CodeBase: file:///C:/Windows/Microso
--------------------------
ImageGear20.Formats.Pdf
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
Accusoft.ScanFixXpress7.Ne
Assembly Version: 7.0.1.1
Win32 Version: 7.0.1.1
CodeBase: file:///C:/Program%20Files
--------------------------
ImageGear20.Core
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
ImageGear20.Formats.Camera
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
ImageGear20.Formats.Common
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
ImageGear20.Formats.Advanc
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
ImageGear20.Formats.Office
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
ImageGear20.Formats.Vector
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
ImageGear20.Presentation
Assembly Version: 20.4.1018.7298
Win32 Version: 20.4.1018.7298
CodeBase: file:///C:/Program%20Files
--------------------------
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
ASKER
{
string LocalFolderPath = Properties.Settings.Defaul t.LocalFol derPath;
if (LocalFolderPath != "")
{
FolderLocation = "Local";
openFileDialog1.InitialDir ectory = Properties.Settings.Defaul t.LocalFol derPath;
if (openFileDialog1.ShowDialo g() == DialogResult.OK)
{
// Reset the initial directory to the current file path
openFileDialog1.InitialDir ectory = System.IO.Path.GetDirector yName(open FileDialog 1.FileName );
// Free up the image xpress view before loading the image, try not lose memory
//if (imageXView1.Image != null)
//{
// imageXView1.Image.Dispose( );
// imageXView1.Image = null;
//}
ClearResultsDisplays();
var hDib = IntPtr.Zero;
// Get the image
try
{
// Use an image loader here
_openFileName = openFileDialog1.FileName;
//string FileName= _openFileName.Replace(".ms g", ".pdf");
//string fileLocation = openFileDialog1.FileName;
//File.Copy(openFileDialog 1.FileName , FileName, true);
//string NFileName= FileName.Replace(".pdf", "");
//string ext = Path.GetExtension(openFile Dialog1.Fi leName);
//if (allExtensions.Any(ext.Con tains))
//{
string appPath = Application.StartupPath;
string defaaultfilePath = @"Esale.pdf";
string pdfurl1 = Path.Combine(appPath, defaaultfilePath);
// string pdfurl1 = "E:\\Invoive 6-2-2016\\FSInvoices\\V1.0 \\Samples\ \DotNet\\C #\\VS2010\ \FSInvoice sDemo\\Ima ge\\Esale. pdf";
var loader = new ImageLoader(pdfurl1, _fsiLicense)
{
PreprocessingOptions = AppPreProcessingOptions.Ge tOptionsFo rDisplay()
};
hDib = loader.ToHdib(true);
//imageXView1.Image = Accusoft.ImagXpressSdk.Ima geX.FromHd ib(imagXpr ess1, hDib, true);
loader.Dispose();
// }
SetCursonAndRunInvoiceProc essing();
//miRun.Enabled = true;
//miValidate.Enabled = true;
//miMergeSplit.Enabled = true;
}
catch (Exception ex)
{
//imageXView1.Image = null;
// Free up the hDib we created
ExceptionHelper.LogFile(ex .Message, e.ToString(), ((Control)sender).Name, this.FindForm().Name);
if (hDib != IntPtr.Zero)
ImageLoader.FreeHdib(hDib) ;
MessageBox.Show(@"Error opening image - " + openFileDialog1.FileName + Environment.NewLine +
@"Message - " + ex.Message, @"Error");
}
}
}
else
{
MessageBox.Show("Please Select Local Folder Path Using Configuration Menu!");
Settings objSettings = new Settings();
objSettings.Show();
}
}
string LocalFolderPath = Properties.Settings.Defaul
if (LocalFolderPath != "")
{
FolderLocation = "Local";
openFileDialog1.InitialDir
if (openFileDialog1.ShowDialo
{
// Reset the initial directory to the current file path
openFileDialog1.InitialDir
// Free up the image xpress view before loading the image, try not lose memory
//if (imageXView1.Image != null)
//{
// imageXView1.Image.Dispose(
// imageXView1.Image = null;
//}
ClearResultsDisplays();
var hDib = IntPtr.Zero;
// Get the image
try
{
// Use an image loader here
_openFileName = openFileDialog1.FileName;
//string FileName= _openFileName.Replace(".ms
//string fileLocation = openFileDialog1.FileName;
//File.Copy(openFileDialog
//string NFileName= FileName.Replace(".pdf", "");
//string ext = Path.GetExtension(openFile
//if (allExtensions.Any(ext.Con
//{
string appPath = Application.StartupPath;
string defaaultfilePath = @"Esale.pdf";
string pdfurl1 = Path.Combine(appPath, defaaultfilePath);
// string pdfurl1 = "E:\\Invoive 6-2-2016\\FSInvoices\\V1.0
var loader = new ImageLoader(pdfurl1, _fsiLicense)
{
PreprocessingOptions = AppPreProcessingOptions.Ge
};
hDib = loader.ToHdib(true);
//imageXView1.Image = Accusoft.ImagXpressSdk.Ima
loader.Dispose();
// }
SetCursonAndRunInvoiceProc
//miRun.Enabled = true;
//miValidate.Enabled = true;
//miMergeSplit.Enabled = true;
}
catch (Exception ex)
{
//imageXView1.Image = null;
// Free up the hDib we created
ExceptionHelper.LogFile(ex
if (hDib != IntPtr.Zero)
ImageLoader.FreeHdib(hDib)
MessageBox.Show(@"Error opening image - " + openFileDialog1.FileName + Environment.NewLine +
@"Message - " + ex.Message, @"Error");
}
}
}
else
{
MessageBox.Show("Please Select Local Folder Path Using Configuration Menu!");
Settings objSettings = new Settings();
objSettings.Show();
}
}
Placing in code tags to make it more readable:
-saige-
localFolderToolStripMenuItem_Click(Object sender, EventArgs e)
{
string LocalFolderPath = Properties.Settings.Default.LocalFolderPath;
if (LocalFolderPath != "")
{
FolderLocation = "Local";
openFileDialog1.InitialDirectory = Properties.Settings.Default.LocalFolderPath;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
// Reset the initial directory to the current file path
openFileDialog1.InitialDirectory = System.IO.Path.GetDirectoryName(openFileDialog1.FileName);
// Free up the image xpress view before loading the image, try not lose memory
//if (imageXView1.Image != null)
//{
// imageXView1.Image.Dispose();
// imageXView1.Image = null;
//}
ClearResultsDisplays();
var hDib = IntPtr.Zero;
// Get the image
try
{
// Use an image loader here
_openFileName = openFileDialog1.FileName;
//string FileName= _openFileName.Replace(".msg", ".pdf");
//string fileLocation = openFileDialog1.FileName;
//File.Copy(openFileDialog1.FileName, FileName, true);
//string NFileName= FileName.Replace(".pdf", "");
//string ext = Path.GetExtension(openFileDialog1.FileName);
//if (allExtensions.Any(ext.Contains))
//{
string appPath = Application.StartupPath;
string defaaultfilePath = @"Esale.pdf";
string pdfurl1 = Path.Combine(appPath, defaaultfilePath);
// string pdfurl1 = "E:\\Invoive 6-2-2016\\FSInvoices\\V1.0\\Samples\\DotNet\\C#\\VS2010\\FSInvoicesDemo\\Image\\Esale.pdf";
var loader = new ImageLoader(pdfurl1, _fsiLicense)
{
PreprocessingOptions = AppPreProcessingOptions.GetOptionsForDisplay()
};
hDib = loader.ToHdib(true);
//imageXView1.Image = Accusoft.ImagXpressSdk.ImageX.FromHdib(imagXpress1, hDib, true);
loader.Dispose();
// }
SetCursonAndRunInvoiceProcessing();
//miRun.Enabled = true;
//miValidate.Enabled = true;
//miMergeSplit.Enabled = true;
}
catch (Exception ex)
{
//imageXView1.Image = null;
// Free up the hDib we created
ExceptionHelper.LogFile(ex.Message, e.ToString(), ((Control)sender).Name, this.FindForm().Name);
if (hDib != IntPtr.Zero)
ImageLoader.FreeHdib(hDib);
MessageBox.Show(@"Error opening image - " + openFileDialog1.FileName + Environment.NewLine +
@"Message - " + ex.Message, @"Error");
}
}
}
else
{
MessageBox.Show("Please Select Local Folder Path Using Configuration Menu!");
Settings objSettings = new Settings();
objSettings.Show();
}
}
-saige-
The only place I see a cast to control is in the catch of the try block; line 61. Since we know the sender is a ToolStripMenuItem, this line probably should have read:
Full code:
-saige-
ExceptionHelper.LogFile(ex.Message, e.ToString(), ((ToolStripMenuItem)sender).Name, this.FindForm().Name);
Full code:
protected void localFolderToolStripMenuItem_Click(Object sender, EventArgs e)
{
string LocalFolderPath = Properties.Settings.Default.LocalFolderPath;
if (LocalFolderPath != "")
{
FolderLocation = "Local";
openFileDialog1.InitialDirectory = Properties.Settings.Default.LocalFolderPath;
if (openFileDialog1.ShowDialog() == DialogResult.OK)
{
// Reset the initial directory to the current file path
openFileDialog1.InitialDirectory = System.IO.Path.GetDirectoryName(openFileDialog1.FileName);
// Free up the image xpress view before loading the image, try not lose memory
//if (imageXView1.Image != null)
//{
// imageXView1.Image.Dispose();
// imageXView1.Image = null;
//}
ClearResultsDisplays();
var hDib = IntPtr.Zero;
// Get the image
try
{
// Use an image loader here
_openFileName = openFileDialog1.FileName;
//string FileName= _openFileName.Replace(".msg", ".pdf");
//string fileLocation = openFileDialog1.FileName;
//File.Copy(openFileDialog1.FileName, FileName, true);
//string NFileName= FileName.Replace(".pdf", "");
//string ext = Path.GetExtension(openFileDialog1.FileName);
//if (allExtensions.Any(ext.Contains))
//{
string appPath = Application.StartupPath;
string defaaultfilePath = @"Esale.pdf";
string pdfurl1 = Path.Combine(appPath, defaaultfilePath);
// string pdfurl1 = "E:\\Invoive 6-2-2016\\FSInvoices\\V1.0\\Samples\\DotNet\\C#\\VS2010\\FSInvoicesDemo\\Image\\Esale.pdf";
var loader = new ImageLoader(pdfurl1, _fsiLicense)
{
PreprocessingOptions = AppPreProcessingOptions.GetOptionsForDisplay()
};
hDib = loader.ToHdib(true);
//imageXView1.Image = Accusoft.ImagXpressSdk.ImageX.FromHdib(imagXpress1, hDib, true);
loader.Dispose();
// }
SetCursonAndRunInvoiceProcessing();
//miRun.Enabled = true;
//miValidate.Enabled = true;
//miMergeSplit.Enabled = true;
}
catch (Exception ex)
{
//imageXView1.Image = null;
// Free up the hDib we created
ExceptionHelper.LogFile(ex.Message, e.ToString(), ((ToolStripMenuItem)sender).Name, this.FindForm().Name);
if (hDib != IntPtr.Zero)
ImageLoader.FreeHdib(hDib);
MessageBox.Show(@"Error opening image - " + openFileDialog1.FileName + Environment.NewLine +
@"Message - " + ex.Message, @"Error");
}
}
}
else
{
MessageBox.Show("Please Select Local Folder Path Using Configuration Menu!");
Settings objSettings = new Settings();
objSettings.Show();
}
}
-saige-
This question needs an answer!
Become an EE member today
7 DAY FREE TRIALMembers can start a 7-Day Free trial then enjoy unlimited access to the platform.
View membership options
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
localFolderToolStripMenuIt
When you find it, post the code in the method. The original author performed an illegal cast.
-saige-