Handle Is Invalid - when doing PrintToPrinter

I have a program installed on maybe 150 computers in our company and randomly (maybe 3-4 times a week) I get the error below from some of these computers. As I said total of 3 to 4 times a week from the 500 odd times this code is run..
  <Message>The handle is invalid</Message>
- <StackTrace>
  <StackItem Method="System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)" LineNumber="-1" />
  <StackItem Method="System.Drawing.Printing.PrintController.Print(PrintDocument document)" LineNumber="-1" />
  <StackItem Method="System.Drawing.Printing.PrintDocument.Print()" LineNumber="-1" />
  <StackItem Method="CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)" LineNumber="-1" />
  <StackItem Method="CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)" LineNumber="-1" />
  <StackItem Method="MobilePhoneSales.AL.usrContractDetails.cmdSaveContract_Click(Object sender, EventArgs e) in Z:\SVN_Repos\MobilePhoneSales\MobilePhoneSales\AL\usrContractDetails.cs" LineNumber="511" />
  <StackItem Method="System.Windows.Forms.Control.OnClick(EventArgs e)" LineNumber="-1" />
  <StackItem Method="DevExpress.XtraEditors.BaseButton.OnClick(EventArgs e)" LineNumber="-1" />
  <StackItem Method="DevExpress.XtraEditors.BaseButton.OnMouseUp(MouseEventArgs e)" LineNumber="-1" />
  <StackItem Method="System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)" LineNumber="-1" />
  <StackItem Method="System.Windows.Forms.Control.WndProc(Message& m)" LineNumber="-1" />
  <StackItem Method="DevExpress.Utils.Controls.ControlBase.WndProc(Message& m)" LineNumber="-1" />
  <StackItem Method="System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)" LineNumber="-1" />
  <StackItem Method="System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)" LineNumber="-1" />
  <StackItem Method="System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)" LineNumber="-1" />
  </StackTrace>
I am running crystal reports version 12.02 and using .net 2.0, the error happens on the PrintToPrinter line of the code below.. Thanks for having a look any questions I will try and respond with as much detail as possible..
                    using (ReportDocument ZeroUpfrontContract = new AL.rptZeroUpfrontContract())
                        ZeroUpfrontContract.SetParameterValue("Header1", BL.HeaderRecord.m_HeaderLine1);
                        ZeroUpfrontContract.SetParameterValue("Header2", BL.HeaderRecord.m_HeaderLine2);
                        ZeroUpfrontContract.SetParameterValue("Header3", BL.HeaderRecord.m_HeaderLine3);
                        ZeroUpfrontContract.SetParameterValue("Header4", BL.HeaderRecord.m_HeaderLine4);
                        ZeroUpfrontContract.SetParameterValue("Header5", BL.HeaderRecord.m_HeaderLine5);
                        ZeroUpfrontContract.SetParameterValue("Stock_code", txtBarCode.Text.Length > 0 ? DL.Inventory.queryStockCode(txtBarCode.Text) : "");
                        ZeroUpfrontContract.SetParameterValue("descript", lblItemDescript.Text);
                        ZeroUpfrontContract.SetParameterValue("IMEI", txtIMEI.Text);
                        ZeroUpfrontContract.SetParameterValue("Comments", "Comments: " + txtComments.Text);
                        ZeroUpfrontContract.SetParameterValue("ContractDate", DateTime.Now);
                        ZeroUpfrontContract.SetParameterValue("CustName", currentCustomer.FirstName.Trim() + " " + currentCustomer.Surname.Trim());
                        ZeroUpfrontContract.SetParameterValue("DataPack", chkDataPlan.Checked ? cboDataPacks.Text : "Declined by customer, therefore Pay As You Go rates will be applicable.");
                        ZeroUpfrontContract.SetParameterValue("ETC", chkETC.Checked ? rdoETC.SelectedIndex == 0 ? "Cancellation fee of $" + txtETCValue.Text + " reoccuring for the next " + txtETCDuration.Text + " months."
                                                                                : "Cancellation fee of $" + txtETCValue.Text + " on next bill."
                        if (cboWarrantyCodes.SelectedIndex > -1)
                            ZeroUpfrontContract.SetParameterValue("Warranty", "1 Year Extended Warranty Included");
                        else
                            ZeroUpfrontContract.SetParameterValue("Warranty", "  ");
                        ZeroUpfrontContract.PrintToPrinter(2, false, 1, 999);

Make sure the printer driver you are using is correct for;
1) The printer type it's self
2) The OS
Your code does not show if you are using .Close and .Dispose on the report objects, but this would be highly recommended.
Make sure you are using SP1:
https://smpdl.sap-ag.de/~sapidp/012002523100006007872008E/crvs05sp1.exe
The above will update your dev computer and install new MSI file that you should use to deploy the SP 1 (SP1 will not install on runtime computers. Only the MSI will):
c:\program files\microsoft visual studio 8\sdk\v2.0\bootstrapper\packages\crystal reports\CRRedist2005_x86.msi
Ludek
Follow us on Twitter http://twitter.com/SAPCRNetSup
Got Enhancement ideas? Try the [SAP Idea Place|https://ideas.sap.com/community/products_and_solutions/crystalreports]

Similar Messages

  • Crystal Report error - The Handle is invalid;

    I get the error 'The handle is Invalid' when I try to print a crystal report that is opened in the Report viewer.
    I was wondering if anyone has encountered this is has a solution.
    The report was created using Crystal Report 2008 for SAP B1.
    Regards
    Albert

    Albert,
    You may check those old threads first:
    Embarrasing issue
    Re: 5 : - The handle is invalid
    Landscape test connection failure: The handle is invalid.
    Thanks,
    Gordon

  • "...handle is invalid" : Error only when closing the Applicatio​n, at RunTime everything seems fine...

    HI,
    first of all: I'm relatively new to LabWindows, working on it during some practical work as a Student
    (yeah, and sorry for the bad english, I'm from Germany)
    To the Problem:
    The first important Information:
    After having searched for a solution, I just don't know, what to do,
    My Project consists of ONE Main.uir-File with a Tab, a "Main.c" that basically handles the main .uir-Stuff and some Initiating-Stuff and in addition to that Several Sub-Sourc-Files, one for each Tab-Panel of the Main.uir-Tab.
    To use the UI-Items on the Main-Tab with the Sub-Sources, I am initiating Tab-Handles at startup, that can be used by the SubSource-Files, like:
    GetPanelHandleFromTabPage (PANEL, PANEL_TAB, 2, &BALU);
    With this Handle, I can identify every UI-Items, when working with the SubSources
    The second important information:
    In some of the TabPages of the .uir there are several ControlArrays. To use them I create a ControlArrayHandle, like:
    MWSAverageHandle  = GetCtrlArrayFromResourceID (BALU, MWSAverageArray);
    No, I am able to identify specific elements of the Arrays, like:
    SetCtrlVal (BALU, GetCtrlArrayItem (MWSProgressHandle, ActiveBalun), ProgressString);
    Now there is a Problem, I am not able to solve:
    During runtime, everything works out fine, I can use every element of a ControlArray with this ControlArrayHandle ("MWSProgressHandle"), everything works perfect, no errors at all. BUT, when closing the programm, I get the following error-message:
    NON-FATAL RUN-TIME ERROR:   "Baluns.c", line 313, col 16, thread id 0x00000AB8:  
    Library function error (return value == -4 [0xfffffffc]). Panel, menu bar, or control array handle is invalid
    But this seems somehow ridiulous to me, because at runtime every single line works perfect, every Array-Item can be used without Problems...
    Is there anything I am just not able to see???
    Thanks a lot for your help.
    Greeting from Lübeck, Germany!
    Mathias
    Solved!
    Go to Solution.

    Maybe I just figured something out:
    First of all, most of the Functions, that cause the Error, are in Timer-Callbacks (at this state of development, ALL of them)
    So I just added a Test-Function in a normal Button-Callback, which contains a "GetCtrlArrayItem"-Function, and this specific Line does NOT cause an Error... (Or at least it does not occur in the Error-List, when clicking "continue" in debugging-mode). Somehow the Timer-Callbacks seem to be called, when closing the Application...
    BUT: this happens when I don't do anything in the Application, and the all Timers are Disabled, until some Buttons are pushed (so when I close the application right after opening it, they still should be disabled) 
    @ Wolfgang:
    After discarding I do not want to use one of the handles, or at least I'm not doing that purposely
    @ Roberto:
    Actually I am only discaring the MainPanel-Handle in the Main.uir (and one other Panel, but the error occurred before implementing that other panel). Do all Handles (PanelHandles as well as ControlArrayHandles, TabPageHandles and so on) need to be discarded?
    And no, I did not check the Variable Window, I was not aware of this possibility, I will try to figure that out.

  • I have instaled Firefox on WinXp, and when a I try to open FF i get a mesage: C:/Program Files/Mozila Firefox/ firefox.exe The handle is invalid. How to resolve this? I have Admin rights

    I have instaled Mozila Firefox on a new Dell laptop witch runs Windows Xp Profesional (I have Administrator rights) and when i try to run Mozila Firefox i get the message C:/Program Files/Mozila Firefox/ firefox.exe The handle is invalid.
    I also tryed to install a previos version of Mozila but it's all the same. How to resolve this problem?
    Thankyou

    Do a malware check with some malware scan programs.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of the database before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]

  • When trying to install Firefox 4.1 (Update) I get the following message: 'The handle is invalid'

    I downloaded Firefox 4.01 directly from Firefox. When running the Firefox Setup I get the following error: 'The handle is invalid'.
    I am trying to run it on: TOSHIBA, Windows Vista, Home Premium, Service Pack 1.

    Repair your Apple software update.
    Go to START/ALL PROGRAMS/Apple Software Update. If it offers you a newer version of Apple Software Update, do it but Deselect any other software offered at the same time. Once done, try another iTunes install
    If you don't find ASU, go to Control Panel:
    START/CONTROL PANEL/Programs n Features/highlight ASU and click REPAIR,

  • Handle is invalid after PrintToPrinter

    Hello,
    The evironment is a 2008 64 bit server that is used for the crystal report generation in a 32 bit application. The printservers that host the printers are 2003 32 bit servers. The first printserver is connected to the 64 bit 2008 using ThinPrint and from there it connects through to the 2003 printserver with the specific drivers for all printers. If you don't know ThinPrint it 's an application used to shrink the spooled fill for less networktraffic.
    We use the redistributable cr2008fp35_redist.zip.
    I receive the following error:
    Message:The handle is invalid
    Source: System.Drawing Stacktrace: at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e) at System.Drawing.Printing.PrintController.Print(PrintDocument document) at System.Drawing.Printing.PrintDocument.Print() at CrystalDecisions.CrystalReports.Engine.FormatEngine.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN) at CrystalDecisions.CrystalReports.Engine.ReportDocument.PrintToPrinter(Int32 nCopies, Boolean collated, Int32 startPageN, Int32 endPageN)
    Kind regards,
    Koen Stoops

    Well, we need some baby steps here. I need to be convinced that the printing works in the simplest instance. And that will be a simple win ap, preferably constructed as follows:
    1) CR Viewer
    2) Two buttons
    3) A saved data report
    4) Button1 code; CRViewer1.ReportSource = <path to saved data report>
    5) Button2 code;
    crReportDocument.PrintOptions.PrinterName = "
    server\myprinter"
    crReportDocument.PrintToPrinter(1, True, 1, 1)
    MessageBox.Show("Report finished printing!")
    6) Compile
    7) Move the app exe to the server
    8) Run the app. Test printing from the viewer 1st, then code (button2)
    - Ludek

  • The handle is invalid error exception when screenshoot from screen why and how to solve

    Hi guys i have problem when i take screen shoot from screen it give me exception
    error the handle is invalid as following
    ee the end of this message for details on invoking
    just-in-time (JIT) debugging instead of this dialog box.
    ************** Exception Text **************
    System.ComponentModel.Win32Exception: The handle is invalid
       at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize, CopyPixelOperation copyPixelOperation)
       at System.Drawing.Graphics.CopyFromScreen(Int32 sourceX, Int32 sourceY, Int32 destinationX, Int32 destinationY, Size blockRegionSize)
       at Sales.Form1.timer4_Tick(Object sender, EventArgs e)
       at System.Windows.Forms.Timer.OnTick(EventArgs e)
       at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)
    this is my code as following :
    under timer tick event problem happen in screen shoot
    the proplem in these lines
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    if i put these lines under button event work ok
    but if i but these lines under timer make problem and give me exception above why
    this code of screenshoot work in my windows xp but when i put in windows server 2003 it give me error in screenshoot under timer event
    private void timer4_Tick(object sender, EventArgs e)
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    if (SalesClass1.IsStartValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123"))
    issent = 1;
    label7.Text = issent.ToString();
    else
    issent = 0;
    label7.Text = issent.ToString();
    if (Convert.ToInt32(label3.Text) > 0 && Convert.ToInt32(label2.Text) > Convert.ToInt32(label3.Text) &&Convert.ToInt32(label7.Text) == 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.InsertShipment("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text));
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(0, 0, 0, 0, bitmap.Size);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    string smtpAddress = "smtp.mail.yahoo.com";
    int portNumber = 587;
    bool enableSSL = true;
    string emailFrom = "[email protected]";
    string password = "3444";
    string emailTo = "[email protected]";
    string subject = "Working Start"+label6.Text;
    string body =
    "Quantity Required" + "" + "(" + label2.Text + ")" + "/" +
    "Quantity Shipped" + "/" + "(" + label3.Text + ")" + "/" +
    "Quantity Remaining" + "/" + "(" + label4.Text + ")";
    using (MailMessage mail = new MailMessage())
    mail.From = new MailAddress(emailFrom);
    mail.To.Add(emailTo);
    mail.Subject = subject;
    mail.Body = body;
    mail.IsBodyHtml = true;
    mail.Attachments.Add(new Attachment("c:\\screenshot.jpeg"));
    System.Net.Mail.SmtpClient shggmtp = new SmtpClient(smtpAddress, portNumber);
    smtp.Credentials = new NetworkCredential(emailFrom, password);
    smtp.EnableSsl = enableSSL;
    smtp.Send(mail);

    Thank you for reply
    timer3 tick event and enabled to maximize the form if minimized
    this is all my code as following
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Net.Mail;
    using System.Net;
    using System.IO;
    using System.Data.SqlTypes;
    using System.Data.SqlClient;
    using System.Runtime.InteropServices;
    using System.Diagnostics;
    using Microsoft.Win32;
    namespace Sales
    public partial class Form1 : Form
    RegistryKey reg = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
    public int issent;
    public int isfinish;
    public Form1()
    reg.SetValue("Sales", Application.ExecutablePath.ToString());
    InitializeComponent();
    private const int SW_HIDE = 0;
    private const int SW_SHOWNORMAL = 1;
    private const int SW_SHOWMINIMIZED = 2;
    private const int SW_SHOWMAXIMIZED = 3;
    private const int SW_SHOWNOACTIVATE = 4;
    private const int SW_RESTORE = 9;
    private const int SW_SHOWDEFAULT = 10;
    [DllImport("user32.dll")]
    private static extern int ShowWindow(int hwnd, int nCmdShow);
    private void Form1_Load(object sender, EventArgs e)
    label8.Visible = false;
    label9.Visible = false;
    label10.Visible = false;
    label2.Visible = false;
    label3.Visible = false;
    label7.Visible = false;
    label8.Visible = false;
    label1.Visible = false;
    label2.Visible = false;
    label3.Visible = false;
    label4.Visible = false;
    Sales.SalesClass SalesClass4 = new Sales.SalesClass();
    string EndQuantity = SalesClass4.MaxEndQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    string TotalQuantity = SalesClass4.MaxTotalQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label9.Text = EndQuantity;
    label10.Text = TotalQuantity;
    if (SalesClass4.IsStartValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123"))
    issent = 1;
    label7.Text = issent.ToString();
    else
    issent = 0;
    label7.Text = issent.ToString();
    label6.Text = DateTime.Now.ToString("dd/MM/yyyy");
    timer1.Start();
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    DataTable dt = SalesClass1.ShowSalesData("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label1.Visible = false;
    dataGridView1.DataSource = dt;
    dataGridView1[0, dataGridView1.Rows.Count - 1].Value = "Total Sum";
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Style.BackColor = Color.Yellow;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Style.ForeColor = Color.Red;
    dataGridView1.Refresh();
    Sales.SalesClass SalesClass5 = new Sales.SalesClass();
    if (SalesClass5.IsFinishValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text)))
    isfinish = 1;
    label8.Text = isfinish.ToString();
    else
    isfinish = 0;
    label8.Text = isfinish.ToString();
    label11.Text = SalesClass5.MaxID1("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    private void timer1_Tick(object sender, EventArgs e)
    label6.Text = DateTime.Now.ToString("dd/MM/yyyy");
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    DataTable dt = SalesClass1.ShowSalesData("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label1.Visible = false;
    dataGridView1.DataSource = dt;
    dataGridView1[0, dataGridView1.Rows.Count - 1].Value = "Total Sum";
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[0].Style.BackColor = Color.Yellow;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[1].Style.ForeColor = Color.Red;
    dataGridView1.Refresh();
    private void dataGridView1_DataSourceChanged(object sender, EventArgs e)
    double Total = 0;
    double Total1 = 0;
    double Total2 = 0;
    for (int i = 0; i < dataGridView1.Rows.Count - 1; i++)
    Total += Convert.ToDouble(dataGridView1.Rows[i].Cells[6].Value);
    Total1 += Convert.ToDouble(dataGridView1.Rows[i].Cells[7].Value);
    Total2 += Convert.ToDouble(dataGridView1.Rows[i].Cells[8].Value);
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[6].Value = Total;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[7].Value = Total1;
    dataGridView1.Rows[dataGridView1.Rows.Count - 1].Cells[8].Value = Total2;
    label2.Text = Total.ToString();
    label3.Text = Total1.ToString();
    label4.Text = Total2.ToString();
    private void timer2_Tick(object sender, EventArgs e)
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    string ID = SalesClass1.MaxID("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    string EndQuantity = SalesClass1.MaxEndQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    string TotalQuantity = SalesClass1.MaxTotalQuantity("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");
    label9.Text = EndQuantity;
    label10.Text = TotalQuantity;
    label11.Text = ID;
    if (SalesClass1.IsFinishValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text)))
    isfinish = 1;
    label8.Text = isfinish.ToString();
    else
    isfinish = 0;
    label8.Text = isfinish.ToString();
    if (Convert.ToInt32(label2.Text) == Convert.ToInt32(label3.Text) && Convert.ToInt32(label8.Text) == 0 && Convert.ToInt32(label2.Text) > 0 && Convert.ToInt32(label3.Text) > 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.InsertLastShipment("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text), Convert.ToInt32(label11.Text));
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y,
    0, 0, Screen.PrimaryScreen.Bounds.Size,System.Drawing.CopyPixelOperation.SourceCopy);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    string smtpAddress = "smtp.mail.yahoo.com";
    int portNumber = 587;
    bool enableSSL = true;
    string emailFrom = "[email protected]";
    string password = "2234";
    string emailTo = "[email protected]";
    string subject = "Working Finish" + label6.Text;
    string body = "Summary for Date" + "" + label6.Text + "" +
    "Quantity Required" + "" + "(" + label2.Text + ")" + "/" +
    "Quantity Shipped" + "/" + "(" + label3.Text + ")" + "/" +
    "Quantity Remaining" + "/" + "(" + label4.Text + ")";
    using (MailMessage mail = new MailMessage())
    mail.From = new MailAddress(emailFrom);
    mail.To.Add(emailTo);
    mail.Subject = subject;
    mail.Body = body;
    mail.IsBodyHtml = true;
    mail.Attachments.Add(new Attachment("C:\\temp2.gif"));
    System.Net.Mail.SmtpClient smtp = new SmtpClient(smtpAddress, portNumber);
    smtp.Credentials = new NetworkCredential(emailFrom, password);
    smtp.EnableSsl = enableSSL;
    smtp.Send(mail);
    private void timer3_Tick(object sender, EventArgs e)
    int hWnd;
    Process[] processRunning = Process.GetProcesses();
    foreach (Process pr in processRunning)
    if (pr.ProcessName == "Sales.vshost")
    hWnd = pr.MainWindowHandle.ToInt32();
    ShowWindow(hWnd, SW_SHOWMAXIMIZED);
    private void timer4_Tick(object sender, EventArgs e)
    Sales.SalesClass SalesClass1 = new Sales.SalesClass();
    if (SalesClass1.IsStartValid("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123"))
    issent = 1;
    label7.Text = issent.ToString();
    else
    issent = 0;
    label7.Text = issent.ToString();
    if (Convert.ToInt32(label3.Text) > 0 && Convert.ToInt32(label2.Text) > Convert.ToInt32(label3.Text) && Convert.ToInt32(label7.Text) == 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.InsertShipment("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123", Convert.ToInt32(label3.Text), Convert.ToInt32(label2.Text));
    Bitmap bitmap = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
    Graphics graphics = Graphics.FromImage(bitmap as Image);
    graphics.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y,
    0, 0, Screen.PrimaryScreen.Bounds.Size,System.Drawing.CopyPixelOperation.SourceCopy);
    bitmap.Save("C:\\screenshot.jpeg", System.Drawing.Imaging.ImageFormat.Jpeg);
    string smtpAddress = "smtp.mail.yahoo.com";
    int portNumber = 587;
    bool enableSSL = true;
    string emailFrom = "[email protected]";
    string password = "2234";
    string emailTo = "[email protected]";
    string subject = "Working Start" + label6.Text;
    string body =
    "Quantity Required" + "" + "(" + label2.Text + ")" + "/" +
    "Quantity Shipped" + "/" + "(" + label3.Text + ")" + "/" +
    "Quantity Remaining" + "/" + "(" + label4.Text + ")";
    using (MailMessage mail = new MailMessage())
    mail.From = new MailAddress(emailFrom);
    mail.To.Add(emailTo);
    mail.Subject = subject;
    mail.Body = body;
    mail.IsBodyHtml = true;
    mail.Attachments.Add(new Attachment("c:\\screenshot.jpeg"));
    System.Net.Mail.SmtpClient smtp = new SmtpClient(smtpAddress, portNumber);
    smtp.Credentials = new NetworkCredential(emailFrom, password);
    smtp.EnableSsl = enableSSL;
    smtp.Send(mail);
    private void timer5_Tick(object sender, EventArgs e)
    if (Convert.ToInt32(label3.Text) == 0 && Convert.ToInt32(label4.Text) == 0)
    Sales.SalesClass SalesClass2 = new Sales.SalesClass();
    SalesClass2.DeleteProcesses("Data Source=192.168.1.5;Initial Catalog=Altawi-last06-01-2015;User ID=admin;Password=123");

  • Cluster network name resource 'Cluster Name' failed registration of one or more associated DNS name(s) for the following reason: The handle is invalid.

    I'm stuck here trying to figure this error out.  
    2003 domain, 2012 hyper v core 3 nodes.  (I have two of these hyper V groups, hvclust2012 is the problem group, hvclust2008 is okay)
    In Failover Cluster Manager I see these errors, "Cluster network name resource 'Cluster Name' failed registration of one or more associated DNS name(s) for the following reason:  The handle is invalid."
    I restarted the host node that was listed in having the error then another node starts showing the errors.
    I tried to follow this site:  http://blog.subvertallmedia.com/2012/12/06/repairing-a-failover-cluster-in-windows-server-2012-live-migration-fails-dns-cluster-name-errors/
    Then this error shows up when doing the repair:  there was an error repairing the active directory object for 'Cluster Name'
    I looked at our domain controller and noticed I don't have access to local users and groups.  I can access our other hvclust2008 (both clusters are same version 2012).
    <image here>
    I came upon this thread:  http://social.technet.microsoft.com/Forums/en-US/85fc2ad5-b0c0-41f0-900e-df1db8625445/windows-2012-cluster-resource-name-fails-dns-registration-evt-1196?forum=winserverClustering
    Now, I'm stuck on adding a managed service account (mas).  I'm not sure if I'm way off track to fix this.  Any advice?  Thanks in advance!
    <image here>

    Thanks Elton,
    I restarted 3 hosts after applying the hotfix.  Then I did the steps below and got stuck on step 5.  That is when I get the error (image above).  There
    was an error repairing the active directory object for 'Cluster Name'.  For more data, see 'Information Details'.
    To reset the password on the affected name resource, perform the following steps:
    From Failover Cluster Manager, locate the name resource.
    Right-click on the resource, and click Properties.
    On the Policies tab, select If resource fails, do not restart, and then click OK.
    Right-click on the resource, click More Actions, and then click Simulate Failure.
    When the name resource shows "Failed," right-click on the resource, click More Actions, and then click Repair.
    After the name resource is online, right-click on the resource, and then click Properties.
    On the Policies tab, select If resource fails, attempt restart on current node, and then click OK.
    Thanks

  • SharePoint Error "The security validation for this page is invalid" when delete an item

    Hi,
    I have SharePoint 2010 setup and works fine until today all of a sudden it throws error "The security validation for this page is invalid" when delete a SharePoint document or list item.
    There is no custom event handler deployed on library/list, and it should not be account issue as the same account works yesterday, and even after I turn off security validation from Central Admin, it still doesn't work.
    The only change I did is turn off Dynamic Compression from IIS, after that I tried enable back Dynamic Compression but it still doesn't work.
    Does anyone know what could be the possible reasons? Thanks in advance.

    hi,
     in the page just try to make this :
    <SharePoint:FormDigest runat="server" />
    PrasadWT

  • Problems with System.in (The Handle is invalid)

    Hi everyone,
    I'm new to these boards. I wanted to ask about a problem I've been encountering. Here is the program as follows:
    import java.io.*;
    public class KeyboardLineInput
    public static void main(String a[])
    InputStreamReader isr=null;
    BufferedReader br = null;
    String line;
    int n=0;
    try
    isr = new InputStreamReader(System.in);
    br= new BufferedReader(isr);
    line=br.readLine();
    while(line!=null)
    System.out.println(n + "\t" + line);
    n++;
    catch(IOException e)
    System.out.println(e.getMessage());
    finally
    try
    isr.close();
    br.close();
    catch(IOException e){}
    The problem is that I get a runtime error when I run it. It keeps telling me java.io.IOException: The Handle is invalid
    I'm running with parameters. My parameters are of course just what I type in. I'm doing this through med editor. Also, I've tried this exact program on multiple computers and I still ge the same exact error. Does anyone have clue as to how to solve this?

    What about this?:
    import java.applet.*;
    import java.awt.*;
    import java.awt.event.*;
    public class GrossApp extends Applet implements ActionListener
        Label screen1 = new Label ("Hourly rate");
        Label screen2 = new Label ("Hours worked");
        Label screen3 = new Label ("Gross pay");
        Label screen4 = new Label ("Withholding tax");
        Label screen5 = new Label ("Net pay");
        TextField rate = new TextField(8);
        TextField hours = new TextField(8);
        TextField grossPay = new TextField(8);
        TextField withTax = new TextField(8);
        TextField netPay = new TextField(8);
        Button CalculatePay = new Button("CalculatePay");
        Button Clear = new Button("Clear");
        boolean bRet=true;
        public void init() {
         Panel pan=new Panel(new GridLayout(6, 2, 5, 5));
         pan.add(screen1);
         pan.add(rate);
         pan.add(screen2);
         pan.add(hours);
         pan.add(screen3);
         pan.add(grossPay);
         pan.add(screen4);
         pan.add(withTax);
         pan.add(screen5);
         pan.add(netPay);
         pan.add(CalculatePay);
         pan.add(Clear);
         CalculatePay.addActionListener(this);
         Clear.addActionListener(this);
         add(pan);
        } //* init()
        /*    public void paint(Graphics g) {
         if (bRet == false)
             g.drawString("Please enter values",100,160);
         else
             g.drawString(" ",100,160);
        } //* paint()
        public void actionPerformed(ActionEvent e) {
         if(e.getSource()==CalculatePay) {
             bRet = Myvalidate();
             if (bRet == true) {
              double dblgrossPay = Double.parseDouble(hours.getText()) *
                                   Double.parseDouble(rate.getText());
              grossPay.setText(String.valueOf(dblgrossPay));
              double grossP = Double.parseDouble(grossPay.getText());
              double withT  = grossP * ((grossP<=300.00)? 0.1 : 0.12);
              withTax.setText(String.valueOf(withT));
              netPay.setText(String.valueOf(grossP - withT));
             else  repaint();
         else if(e.getSource()==Clear) {
             hours.setText("");
             rate.setText("");
             grossPay.setText("");
        } //* actionPerfomed(ActionEvent)
        public boolean Myvalidate() {
         return !hours.getText().equals("") && !rate.getText().equals("");
        } //* Myvalidate()
    }

  • The name on the security certificate is invalid or does not match the name of the site

    Hi Guys,
    Every time when we login to SAP Business One, we are getting two identical security Alerts, that we needs to click "Yes" twice.
    Text of error: “The name on the security certificate is invalid or does not match the name of the site”
    We tried to install certificate, but it is not solved this certificate issue and the alert still pops up on login.
    I guess, something wrong with dashboard settings, but don't really know what exact and how to fix it.
    Thanks,
    Sergey

    Hi,
    Please check SAP note:
    1810486 - Dashboard Certificate Sercurity Alert appears on every
    logon to Business One
    Thanks & Regards,
    Nagarajan

  • The name on the security certificate is invalid or does not match the name of the site" : IE

    Hi All,
    All clients are getting “the name on the security certificate is invalid or does not match the name of the
    site” when its reboot and try to access website.
    I don’t have idea about certificate authority. Can anyone help on how I start troubleshooting this.
    Is there any group policy setting which resolve this issue.
    Please suggest what parameter I have to check. 

    > All clients are getting “the name on the security certificate is invalid
    > or does not match the name of the site” when its reboot and try to access website.
    "View Certificate" should tell you.
    Greetings/Grüße,
    Martin
    Mal ein
    gutes Buch über GPOs lesen?
    Good or bad GPOs? - my blog…
    And if IT bothers me -
    coke bottle design refreshment (-:

  • Exchange 2013 w/Outlook 2013 "The name of the security certificate is invalid or does not match the name of the site"

    I've completed an upgrade from Exchange 2003 to Exchange 2013 and I have one last SSL message that I can't get rid of.  I've installed a 3rd party cert that is working great for webmail and cell phone access but for some reason the Outlook 2010/2013
    clients get prompted for a security warning.  I just implemented the SSL cert yesterday and I've noticed that new installs of Outlook seem to work just fine.  My Outlook 2013 client doesn't prompt me with the message but I have other users who are
    still getting the "The name of the security certificate is invalid or does not match the name of the site" error.  The domain on the cert error show up as server.mydomain.local.  I've gone through all the virtual directories and pointed
    all of my internal and external URL's to https://mail.mydomain.com.   This made one of the two warnings go away but not the second.  I've dug around on google and gone through everything I could find here and as far as I can tell my internal
    and external url's are configured properly and I can't figure out where this error is originating from.  Any ideas on where I should look outside of the virtual directories? 
    I'm including a good link I found that contains all of the virtual directories I updated.  I've checked them through both CLI and GUI and everything looks good.
    http://www.mustbegeek.com/configure-external-and-internal-url-in-exchange-2013/
    http://jaworskiblog.com/2013/04/13/setting-internal-and-external-urls-in-exchange-2013/

    Hi,
    When the Outlook connect to Exchange 2013/Exchange 2010, the client would connect to Autodiscover service to retrieve Exchange service automatically from server side. This feature is not available in Exchange 2003 Outlook profile.
    Generally, when mailbox is moved to Exchange 2013, the Outlook would connect to server to automatically update these information. It needs time to detect and update the changes in server side. I suggest we can do the following setting For autodiscover service:
    Get-ClientAccessServer | Set-ClientAccessServer –AutodiscoverServiceInternalUri https://mail.mydomain.com/autodiscover/autodiscover.xml
    Please restart IIS service by running IISReset in a Command Prompt window after all configuraions.
    Regards,
    Winnie Liang
    TechNet Community Support

  • The name of the security certificate is invalid or does not match the name of the site error?

    I am looking for some help folks. We are in a Outlook 2007/Exchange2010/Windows2008R2 environment.
    When users open Outlook off the network, and occasionally on the network, they get the error
    The name of the security certificate is invalid or does not match the name of the site error
    The CAS hostname is HRECAS.XXX.ORG. The URL that is listed on the SSL certificate (issued by VeriSign) is WEB.XXX.ORG. WEB.XXX.ORG is what users use to get to OWA and such.
    When I use testexchangeconnectivity.com, under certificate name validation I see an error that reads:
    Host name autodiscover.xxx.org doesn't match any name found on the server certificate CN=web.xxx.org.
    Does this mean somehow we have to add autodiscover.xxx.org on the certificate?
    I tried to add AutoDiscoverExternalUri using
    http://support.microsoft.com/?kbid=940726 &
    http://social.technet.microsoft.com/Forums/en-US/exchange2010/thread/2d0c0f5f-e4ec-4f33-a37d-b94fd7a2319f on the CAS server.
    Set-ClientAccessServer -identity HRECAS -AutodiscoverServiceExternalUri
     https://autodiscover.xxx.org/Autodiscover/Autodiscover.xml 
    I get an error that says
    "a positional parameter cannot be found that accepts argument '-AutoDiscoverExternalUri'.
    Can someone point to me what I am doing wrong with the command and whether I should be concerning myself with adding that line? By the way the
    InternalUrl information is already configured on the system. Also should I edit the certificate to add autodiscover.xxx.org?
    Thank in advance for your support.
    TD
    TD

    Hi Tapera,
    Thanks for the question.
    SRV record is a good idea. You can set the SRV to
    https://web.abc.com/autodiscover/autodiscover.xml but you must make sure the
    url can be resolved from External clients.
    In addition, there is still a issue. It is hard coded that Outlook will find the autodiscover by the orders below:
    1. Access autodiscover via SCP in AD.
    https://web.abc.com/autodiscover/autodiscover.xml
    2. If SCP access fails, it will try:
    https://abc.com/autodiscover/autodiscover.xml
    3. Then
    https://autodiscover.abc.com/autodiscover/autodiscover.xml
    4. Local XML file
    5. SRV record
    As you can see, Outlook will try SRV record at last. Therefore, it will still try to access
    https://autodiscover.abc.com/autodiscover/autodiscover.xml each time you run Outlook. Then the certificate warning will still persists.
    I have a workaround solution. You can do a local policy to disable the autodiscover to access the
    https://autodiscover.abc.ocom/autodiscover/autodiscover.xml by:
    1.   
    On the Outlook client machine, open regedit and add the following key:
    HKEY_CURRENT_USER\Software\Microsoft\Office\12.0\Outlook\Autodiscover
             "ExcludeHttpsAutodiscoverDomain"
             "ExcludeHttpsRootDomain"
    2.   
    Then set the value to “1” on the above two keys.
    Thanks,
    Simon  

  • ABAP Dump is encountered when doing the negative subsequent adjustment

    Hi Experts !!!
    An ABAP Dump is encountered when doing the negative subsequent adjustment (posting a 102 movt type) on a Purchase Order via the Z function module. The dump only happens if the scenario satisfies the following conditions:
    1.Material is either (but may not be limited to) 3000000234, 4000000121, 3000000210 (These are the only reported materials)
    2.Order unit in Purchase Order is in MT
    3.At 2nd weigh, Net Weight is less than PO Order Qty.
    Note: No error occurs if same process is done via MIGO.
    Initial Analysis:
    An exception/error occurs when calling function u201CMB_CREATE_MATERIAL_DOCUMENT_UTu201D .
    Please see below error anlysis report from after executin Zfunction module code.
    Error analysis
       Short text of error message:
       Material 3000000234 / US01 Column 0001: MSEG-BPMNG not in quantity table
       /not consistent
       Long text of error message:
        Diagnosis
            Before the system posts a material document for an HPM/TDP material
            (MARA-CMETH = 1 or 2), it performs the following consistency
            checks:
            o   For each unit of measure in the Unit of Measure Group
                (MARC-UOMGR), a line item  has to be present  in the additional
                quantity appendix table (Table MSEGO2)
            o   For each unit of measure in the main core table MSEG that is
                not initial a line item, has to be present in the additional
                quantity appendix  table (Table MSEGO2) and the corresponding
                packed format quantities have to be identical.
                This way, inconsistent stock level updates can be prevented.
        System Response
            The system stops processing.
        Procedure
            If the error is reproducible, contact your system administrator.
        Procedure for System Administration
            The inconsitency can have several reasons, for example:
            o   Incorrect postings from external systems using function module
                MB_CREATE_GOODS_MOVEMENT
            o   Handling errors
            o   Application programming errors
       Technical information about the message:
    Message class....... "O3"
    Number.............. 359
    Variable 1.......... 3000000234
    Variable 2.......... "US01"
    Variable 3.......... 0001
    Variable 4.......... "BPMNG"
    Please let me know,if you want some other details.

    Problem Issolved

Maybe you are looking for