.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Lee Hnetinka
mithun
Post New Web Links

Overflow exception on DrawLine method ?

Posted By:      Posted Date: November 25, 2010    Points: 0   Category :Windows Application
 

The following lines in a form throws exception. I dont understand the reason for this exception.

 

 

protected override void OnPaint(PaintEventArgs e)

{

            base.OnPaint(e);

            using (Pen pp = new Pen(Color.FromArgb(225, 237, 139, 76)))

            {

                e.Graphics.DrawLine( pp,205,1600, 550, -1073740352);

// However the following line does not producess the error

// e.Graphics.DrawLine( pp,205, 1599, 550, -1073740352);

            }

 }

 

 

Anyone there please explain the reason for this exception.

Any help would be appreciated.

 


Regards Vallarasu S. BreakingDotNet.blogspot.com


View Complete Post


More Related Resource Links

Cash Drawer - Method Open threw an exception - Windows Service

  
Hi All, I'm getting the following exception while calling Open method of Cash Drawer object. Method Open threw an exception.  Could not read the device name key's default value, or could not convert the Programmatic ID it holds into a valid Class ID. Code:   class Class1 { CashDrawer _uniCashDrawer1 = null; DeviceInfo cashDrawerDevice1 = null; PosExplorer posExplorer = new Microsoft.PointOfService.PosExplorer();   public void ClaimCashDrawer() { cashDrawerDevice1 = posExplorer.GetDevice("CashDrawer", "testDrawer"); if (cashDrawerDevice1 != null) { _uniCashDrawer1 = posExplorer.CreateInstance(cashDrawerDevice1) as CashDrawer; if (_uniCashDrawer1 != null) { _uniCashDrawer1.StatusUpdateEvent += new StatusUpdateEventHandler(UniCashDrawer1_StatusUpdateEvent); _uniCashDrawer1.Open(); _uniCashDrawer1.Claim(0); _uniCashDrawer1.DeviceEnabled = true; } } } }   Tha above code works fine if you put the code in WindowsApplication in all POS systems. The same is working if you put the code in Windows Service in all other POS systems. The same is not working if you put the code in Windows Service in Aures Galeo POS systems.  Thanks in advance. Ramakrishnan S

arithmetic overflow exception

  
Hi, I have a textbox which accepts a decimal. This is stored in the db as decimal(19,5). I get an arithmetic overflow exception when i try to save a value that is greater than 14 places before the decimal.e.g. 123456789123456.36I understand that the 19 includes the 5 decimal places, so i'm trying to fix this by setting a maxlength on the textbox. What should it be? If i set it to 14, then i must enter a number with decimals and the total length can only be 14. e.g. 345678923.45If i set it to 19, it will crash for numbers greater than 14 points before the decimal. e.g 123456789123456.36Not sure how to handle this...any suggestions?

Weird Exception: Method not found: 'Double System.Windows.Controls.ScrollViewer.get_ContentHorizon

  
Hi guys I have an XBAP application that uses a Xamdatagrid from Infragistics. I have some filtering on this grid, that rebinds after a filter. The problem is, when a user has scrolled to a certain point and then filters, the rebinding causes the grid to scroll to the beginning position of the grid. Now how I solve this is by getting an instance of the ScrollViewer, I get the ScrollViewer.ContentHorizontalOffset and then I do a ScrollViewer.ScrollToHorizontalOffset after it filters.   Now here comes the problem. For 99% of the users of this xbap app, this will work absolutely fine. Most, if not all of the users run exactly the same machines, XP 64 bit with 8GB RAM. The other 1% get the error: Method not found: 'Double System.Windows.Controls.ScrollViewer.get_ContentHorizontalOffset()'. I cannot reproduce this error on my own box, our dev server or our production server, it is a phantom exception that only pops up on a certain condition. I have even wrapped the "offending" code in a try catch and it still doesn't solve it. If I set the DispatcherUnhandledExceptionArgs Handled to true, it works, but it doesn't feel right. How is this possible? If the method doesn't exist, how can it compile? Why does that method exist for 99% of the other users running the exact same machines? I have googled my fingers raw without any valid results and this issue is frustrat

Exception Handling: StackFrame Capture not capturing last level method call in release mode

  

I am trying print the exception details frame by frame along with other debug info (code below). In the code as you can see the DummyCall3 throws and ApplicationException and the expectation is that the stack trace will have information regarding DummyCall3. Below are the behavior I am getting with .NET 4.

  • Using the "Debug" build, when I run it, I get expected results (DummyCall3 > DummyCall2 > DummyCall > RunTest)
  • Using the "Release" build however, the DummyCall3 method is somehow missing from the stack trace. Now I only get (DummyCall2 > DummyCall > RunTest)
  • I add a dummy statement in the DummCall3 method before I throw the exception, and rerun using "Release" mode and now it works as expected with strack trace info (DummyCall3 > DummyCall2 > DummyCall > RunTest)
  • If I switch the framework version to .NET 3.5 it works as expected in both Release and Debug modes?

I would like to know if this behavior is by design or a bug? if it is by design, what was the reasoning behind it. Appreciate any input on this.

 

  class StackFrameTest
  {
    public void RunTest()
    {
      

CreateDocument method in CMIS Object Service raising the Constraint Violation Exception

  

HI All,

Below are the code snippet for rasing the above exception like  "The operation violates a Repository- or Object-level constraint defined in the CMIS domain model. "

ObjectService.

ObjectServicePortClient objectService = new TestCMISWinApp.ObjectService.ObjectServicePortClient("BasicHttpBinding_IObjectServicePort");

objectService.ClientCredentials.Windows.AllowNtlm =

true;

objectServi

"An overflow occurred while converting to datetime Exception

  

 

32 Bit Vista RTM - Patch Level up todate. - Desktop

SQL CE V3.5

VS2008 - RTM

 

I have a really strange problem where I am receiving a ""An overflow occurred while converting to datetime Exception."

 

I have an existing database where I am making a copy of an old row, and updatting date/time fields. The old fields were filled with date/time and the columns are datetime columns.

 

Private Function CopyChildRowsDST(ByVal SearchID As Guid, ByVal CurrentParentID As Guid, _

                                      ByVal dsttbl As DataTable) As Boolean

Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust

  

Hi,

I want to pass parameter to Silverlight Control deployed as a Webpart.For this i used WebpartStorageAttribute for getting the values while configuring the Webpart.

It deployed Successfully but when i try to add webpart its raising the following error

Unhandled exception was thrown by the sandboxed code wrapper's Execute method in the partial trust app domain: Could not load type 'Microsoft.SharePoint.WebPartPages.WebPartStorageAttribute' from assembly 'Microsoft.SharePoint, Version=14.900.0.0, Culture=neutral, PublicKeyToken=71e9bce111e9429c'.

Thanks in Advance


Exception with Microsoft.Office.Interop.Outlook method Members.Add

  

Hi,

I am using Visual Studio 2.0 and Microsoft Outlook 11.0 Object Library in a windows application.

I am trying to create a distribution list of contacts in outlook and add members to it. Creating a contact or a distribution list works fine, but when I try to user Members.Add method I get the following exception: "An attempt was made to open an unsupported property."

I am using this post as example code :http://support.microsoft.com/kb/178787

This is the detailed exception:

System.Runtime.InteropServices.COMException was unhandled
  ErrorCode=-417070846
  Message="An attempt was made to open an unsupported property."
  Source="Microsoft Office Outlook"
  StackTrace:
       at Microsoft.Office.Interop.Outlook.AddressEntries.Add(String Type, Object Name, Object Address)

 

I couldn't find any info about this on the web, I would be happy to get some support.

Regards,

Lynda


Unhandled exception occurred while calling method 'ProjectItemInitialized'

  

We have created our own DSL for building BCS Models. The product works fine but when we first create the model we get the following warning:

"Unhandled exception occurred while calling method 'ProjectItemInitialized' of type 'Microsoft.VisualStudio.SharePoint.ProjectExtensions.Bdc.VSPackage.BdcDefinition, Microsoft.VisualStudio.SharePoint.ProjectExtensions.Bdc, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Exception: System.Xml.XmlException. Message: Root element is missing."

 I know this is because we build our model slightly differently but I wanted to know if there was a way to prevent this exception from occuring. It causes absolutely no problems but I would like to know how to get around this warning, if possible.

Thanks

 

Phill


Lightning Tools::BCS Meta Man

TimeOut exception when using MetadataExchangeClient GetMetadata method with valid mex EndpointAddres

  

Hello all,

I have a ServiceHost with a defined tcp mex endpoint at net.tcp://localhost:9003/MyService/mex. Other code can successfully read metadata from the endpoint.

Using the following code, I get a TimeOut exception with this error message even though the timeout interval is set to 3 minutes:

This request operation sent to net.tcp://localhost:9003/CalculatorService/mex did not receive a reply within the configured timeout (00:03:00).  The time allotted to this operation may have been a portion of a longer timeout.  This may be because the service is still processing the operation or because the service was unable to send a reply message.  Please consider increasing the operation timeout (by casting the channel/proxy to IContextChannel and setting the OperationTimeout property) and ensure that the service is able to connect to the client.

MetadataExchangeClient mexClient = new MetadataExchangeClient(metadataAddress);

// mexClient.HttpCredentials = New System.Net.NetworkCredential()

mexClient.ResolveMetadataReferences = true;

mexClient.OperationTimeout = New TimeSpan(0, 3, 0);

MetadataSet metaDocs = mexClient.GetMetadata();

The metadataAddress comes f

Parameter is not valid exception on image.fromstream() method

  

Hi,

      i have written a code for resizing the images and its working good except for some images that too the issue is occuring only on locolhost(IIS). I have asynchronous file upload contorl and two button  controls. when clicked on first button  the asynchronous file upload control is saved in session using the following code

Session["myupload"] = AsyncFileUpload1.PostedFile;

The image is resized and saved in a folder when second button clicked. The following code will execute when clicked the second button.

HttpPostedFile hif = (HttpPostedFile)Session["myupload"]                        
                        if (hif.ContentLength <= 20000000)
                        {
                            if (checkfiletype(hif.FileName))
                            {
                                string spacefileName = hif.FileName;                                
                                                               
                                string storePath = Server.MapPath("~") + "/Docs";
                                //MemoryStream source = hif.InputStream;
                                Stream source = hif.InputStream;
                                //source =(MemoryStream)hif.InputStream;
                                byte[] input=new byte[hif.ContentLength

Thinking about new C# method prototypes: object as dictionary

  
I recently had to write a small Flickr API. I know many .Net API for Flickr already exist but I needed one for a Silverlight application. Whatever, it's only about building some querystrings so I did it by myself. It's been an opportunity to think again about a classical question: how to pass parameters to a method ?

Imagine you have a generic method to call some Flickr functions.

EXCEPTION HANDLING IN C#

  
Every self-respected programmer should include exception handling techniques. Sometimes your application will generate an error. Regardless of who was responsible for this error, the programmer or the user, it is up to the first to include the necessary exception handling techniques to keep his/her program from crashing. The .Net environment provides useful techniques for avoiding disastrous errors such as try-catch statements and user-defined exceptions.

Global Exception Handling with ASP.NET

  
After your global exception handler has done its work, you'll want to redirect the users of your website to a friendly page that tells them that something has gone wrong, and then provide them with customer support information as well as a link back to your web application's home page.

SQL Server 2005 Try and Catch Exception Handling

  
I'm pretty excited to see that there is some real error handling for T-SQL code in SQL Server 2005. It's pretty painful to have your wonderfully architected .NET solution tainted by less-than-VBScript error handling for stored procedures in the database. The big difference being the addition of TRY..CATCH blocks. Let's take a look:

Sys.Net.WebServiceFailedException: The server method '' failed with the following error:

  

 Hello...

Let's say we have 2 time consuming functions, aaa and aaa1 inside a aspx page.

[WebMethod]
        public static string aaa(int i)
        {
            Thread.Sleep(1000);
            return i.ToString();
        }

        [WebMethod]
        public static string aaa1(int i)
        {
            Thread.Sleep(1000);
            return i.ToString();
        }

 

 

<div>
        <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePageMethods="true">
        </asp:ScriptManager>
        <span id="displayspan"></span>
        <br />
        <input type="button" value=

Jscript error: Object does not support property or method

  

 Hi, i have little knowledge on javascript but i need to use this code get from somewhere for a jquery to work.

I face this "Jscript runtime error: Object does not support property or method" whenever im trying to run this page.

In my experience, im get this error msg 9 out of 10 times i use javascript in my system.

Im using Microsoft Visual web developer 2008, i wonder if this is related to my problem, i not sure there is anything i need to add as reference or update anything.

But anyway, in short, i just couldn't use javascript code when using this development tool because of this sort of error.

Anyway, it happen that last time i tried use the same type of jquery code in another project and it seems to work well without an error.

But now when im try to use it again in this recent project i created, it come out with this error and i have no idea how to solve it even look through google and this forum.

It doesn't really seems like its the code problem itself although im not sure, because any javascript code just couldn't work.

So below is my code that i need to use.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js" ></script>
<script type="text/javascript" src=&quo
Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend