Try to change Printer of my old application windows fourm - c#

I designed a Windows form application many years ago, and due to my lack of experience in programming and not following some professional programming tips to debug it, also I have lost the project source code. I know I had statically defined the printer name in the software, how can I access my source code?
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
CrystalDecisions.Shared.CrystalReportsException: Load report failed. ---> System.Runtime.InteropServices.COMException (0x80004005): The system cannot find the path specified.
at CrystalDecisions.ReportAppServer.ClientDoc.ReportClientDocumentClass.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.Open(Object& DocumentPath, Int32 Options)
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
--- End of inner exception stack trace ---
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at MehrPouyan.ServiceForm.SendPrint()
at MehrPouyan.ServiceForm.btnPrint_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

I solved my problem by decompiling my software and used this link to decompile

Related

Load Report Failed when importing .rpt file

So I'm trying to load an .rpt file to my c# project by setting the datasource as the rpt file. But the problem is I get an error saying;
CrystalDecisions.Shared.CrystalReportsException: 'Load report failed.'
Here is the complete error code that is showing
CrystalDecisions.Shared.CrystalReportsException
HResult=0x80131600
Message=Load report failed.
Source=CrystalDecisions.CrystalReports.Engine
StackTrace:
at CrystalDecisions.ReportAppServer.ReportClientDocumentWrapper.EnsureDocumentIsOpened()
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename, OpenReportMethod openMethod, Int16 parentJob)
at CrystalDecisions.CrystalReports.Engine.ReportDocument.Load(String filename)
at payrollsystemLatest.viewcr.button1_Click(Object sender, EventArgs e) in D:\echosystem\1080proll(new)\payrollsystemLatest\viewcr.cs:line 30
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at payrollsystemLatest.Program.Main() in D:\echosystem\1080proll(new)\payrollsystemLatest\Program.cs:line 21
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
COMException: Unable to load report.
Here is my code to load the rpt file to the viewer
ReportDocument rpt = new ReportDocument();
rpt.Load(#"D:\sample.rpt");
reportviewer.ReportSource = rpt;
reportviewer.Refresh()
So far, I have tried;
Double checking my destination where the .rpt file is
Deleting everything in the TEMP folder
Setting my printjob to -1
And reinstalling both 32 and 64 bit runtime
Any ideas how to fix this? Any help are appriciated!

con.open() error in visual studio 2019 if want to connect with mysql

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for 'MySql.Data.MySqlClient.MySqlConnectAttrs' threw an exception.
Source=MySql.Data
StackTrace:
at MySql.Data.MySqlClient.NativeDriver.SetConnectAttrs()
at MySql.Data.MySqlClient.Authentication.MySqlAuthenticationPlugin.Authenticate(Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Authenticate(String authMethod, Boolean reset)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.CreateNewPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at db4.Form1.button1_Click(Object sender, EventArgs e) in D:\C# GUI\db4\db4\Form1.cs:line 27
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, WM msg, IntPtr wparam, IntPtr lparam)
Inner Exception 1:
FileNotFoundException: Could not load file or assembly 'System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
I have installed the connector below one
https://dev.mysql.com/downloads/connector/net/
but not working
I am using the 5.0 framework
this is the screenshot of the error in visual
Have you tried with the following installation?
PM> Install-Package MySqlConnector -Version 1.3.1
This could be a workaround!

.NET WinForms: Cound not load System.Runtime

I was writing an app for a friend who wanted an easy way to use Morse Code.
I was attempting to use an External Library that I wrote with Morse Code support, and when I try to call it, I get this error, in an External "Control.cs" file. I found happened in both Visual Studio and JB Rider, though Visual Studio gives a different error as it can't debug external sources.
My usings are:
using CainsSharpTools; // <= This is my Library
using System.Diagnostics;
using System.Windows.Forms;
And my function call looks like this:
private void buttonEncode_Click(object sender, System.EventArgs e)
=> textBoxMorse.Text = MorseCode.Parse(textBoxPlain.Text).Value;
The error is
System.IO.FileLoadException: Could not load file or assembly 'System.Runtime, Version=4.2.2.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
at at MorseCoder.Form1.buttonEncode_Click(Object sender, EventArgs e)
at at System.Windows.Forms.Control.OnClick(EventArgs e)
at at System.Windows.Forms.Button.OnClick(EventArgs e)
at at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at at System.Windows.Forms.Control.WndProc(Message& m)
at at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at at System.Windows.Forms.Button.WndProc(Message& m)
at at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at at System.Windows.Forms.Application.Run(Form mainForm)
at MorseCoder.Program.Main() in C:\Users\caina\source\repos\MorseCoder\MorseCoder\Program.cs:19
i needed to use .NET Standard with my Lib

FWTools/GDAL error in release version

I'm using FWTools and SharpMap (with gdal_sharp) to build an application. And I have a weird error. Loading a raster layer runs great in Debug mode, but in Release it throws an Exception in SharpMap.Layers.GdalRasterLayer in the constructor when calling
_projectionWkt = _gdalDataset.GetProjectionRef();
The full exception is:
{System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at OSGeo.GDAL.GdalPINVOKE.Dataset_GetProjectionRef(HandleRef jarg1)
at OSGeo.GDAL.Dataset.GetProjectionRef()
at SharpMap.Layers.GdalRasterLayer..ctor(String strLayerName, String imageFilename) in d:\Fakultet\IX Semestar\GIS\Projekat\GreenGIS\SharpMap.Extensions\Layers\GdalRasterLayer.cs:line 404
at GreenGIS.Form1.addRasterLayer() in d:\Fakultet\IX Semestar\GIS\Projekat\GreenGIS\GreenGIS\Form1.cs:line 50
at GreenGIS.Form1.toolStripButtonAddVector_Click(Object sender, EventArgs e) in d:\Fakultet\IX Semestar\GIS\Projekat\GreenGIS\GreenGIS\Form1.cs:line 129
at System.Windows.Forms.ToolStripItem.RaiseEvent(Object key, EventArgs e)
at System.Windows.Forms.ToolStripButton.OnClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
at System.Windows.Forms.ToolStripItem.FireEventInteractive(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStripItem.FireEvent(EventArgs e, ToolStripItemEventType met)
at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ToolStrip.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at GreenGIS.Program.Main() in d:\Fakultet\IX Semestar\GIS\Projekat\GreenGIS\GreenGIS\Program.cs:line 19}
The weird thing is that in Debug everything works fine. The build setup is exact, both .Net 4.0, x86 Platform.
Any ideas?
Thankyou in advance
I ran into similar problems but after using the current compiled binaries from Link the problem was fixed. I documented the steps that worked for me at http://vipassanaandenvironmentalinformatics.blogspot.co.nz/2013/03/getting-started-with-c-and-gdal.html.
Hope this answer is still of help to others.
It seems to be a problem with Windows 8 and it's DEP implementation along with .Net 4.0. I'm using a C++ dll in a wrapper, and the OS does not let it execute. It could be solved by editing the DLL or turning Data Execution Prevention off.

unable to run my video project on client machine in c#?

i have made a window application in c# its play multiple videos at a time ... i used DirectX SDK june 2010... its working fine in my machine but it giving an exception in clients machine ... the machine has DirectX11 installed so it's not a problem there ... the exception i am getting is ...
************** Exception Text **************
Error in the application.
-2147220891 (VFW_E_UNSUPPORTED_STREAM)
at Microsoft.DirectX.AudioVideoPlayback.Video.Open(String fileName, Boolean autoRun)
at Microsoft.DirectX.AudioVideoPlayback.Video..ctor(String fileName)
at Video_Project.FormMain.FormMain_Load(Object sender, EventArgs e) in D:\Video_Project\Video_Project\Form1.cs:line 240
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
pls any one help me on this .....pls i am stuck in this for whole day
To check the machine's installed wmp codecs:
Go to WMP, press alt to get the menu, select Help->About... then click Tech Support Info. It will generate a report which amongst other things lists all the supported audio and video codecs.
Do this on both machines, Hopefully this should reveal the missing codec.

Categories

Resources