C# - Force An Exception If A Developer Uses A Property Incorrectly?

Feb 26, 2010

I am trying to setup a few fixes in some code that have caught me out, and am trying to get some exceptions to spit out if the developer trys to access a property where rules haven't been met.

[Code]....

View 1 Replies


ADVERTISEMENT

Get Unhandled Exception Information To Developer

Jan 26, 2010

I am wondering how I would get the information on what errors get processed by the application.unhandledexception. I already handle the event and gather the information, but I am unsure how or what the best way to get that information to me (the developer).

So far I have vdialog that asks the user if he/she wants to send the error to me, kind of like when an error occurs in Windows XP and a dialog asks the user if they would like to send information about the error to microsoft. I am unsure what to do when the user clicks "Send".

I have thought about emailing to me, but I don't really want to put my email address as the from, because I might change it or its password in the future, thus breaking its usability.

I cannot yet do an anonymous FTP upload, because my website only allows one FTP user, and that is used only to update the website.

I also have thought about using the user's default email program, but that will not work in most cases of people who rely on web mail.

View 2 Replies

C# - RefreshProperties Attribute At Class Level In .net, Winforms + Incorrectly Refreshing Property Grid?

Feb 15, 2010

I had a strange problem editing a class in the property grid whereby the property grid would refresh incorrectly.I managed to reduce the problem down to a class with just two properties. I've included the code at the end to ease explanation.It basically boils down to a class with two properties. The first of which is expandable (a font)The class itself is expandable and also implements the CreateInstance method in the type converter.To see the problem, expand the font, edit, say 'Bold', and tab away. Two problems happen:

(1) The second property jumps up and ends up in the expanded font property.

(2) The '-' sign of the expanded font changes to a '+'.

The problem goes away by attaching ResfreshProperties(RefreshProperties.All) to the class. That's great, but I'd like to understand how it fixed the problem. I've had a look in reflector and can't find any examples of RefreshProperties being attached at the class level.

[code]...

View 1 Replies

Concurrency Handle Is Part Of The Software Developer Or Database Developer?

Jul 23, 2009

In CRUD application development we have to face the issues with concurencies in Ids such as Generate and display UNique EmployeeIDs on forms. Currently i'm writting .DLL file that has a class that will handle concurrencies.

But i'm puzziled with the Question, is this concurrency handle is part of the software developer or Database developer?

View 9 Replies

Force Method To Handle Thrown Exception?

Aug 9, 2010

I want to force a calling method to implement exception handling.

Java forces a calling method to implement exception handling where it calls another method that thorws an exception.

Does VB.Net have the same mechanism?

View 1 Replies

Throw Exception When Certan Property Or Value Is Negtive?

Feb 9, 2012

I'm not getting any errors, or anything I just forgot how to do error checking in the "set" portion of properties

I have 3 Classes, my frmMain,Sales and a Validator Class

Code for the Validator Class:

CODE:

Code for my Sales Class:

CODE:

I need to Throw an Excepton when the Sales price is Zero or negitive and when the trade in allowance is negtive I'm not quite sure how to do that in the Object Oriented Manner.

View 4 Replies

Accessing The Property Inside Dynamic Control Gives Null Reference Exception?

Jul 13, 2010

I have an app with 24 different Forms. They have some security options based on which the 5 different buttons Submit, Approve, 2nd Approve, 3rd Approve, Reject etc get enabled disabled.Now I designed a MainForm that has all the buttons and the security code for them. I have created eachform as a usercontrol and load them dynamically based on which form the user wants. My loading works perfectly fine. I load the control and Add it to the place holder in the Page load event of the main page.

Now when the user selects the Submit button I want to call the Save method inside the usercontrol of the Form as each form will have a separate Save. So when I try this code snippet I get the Null reference error. Do let me know how to resolve it.

Private UCDynamic As UserControl

Then on Page Load event I use this code

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If not Me.IsPostBack
UCDynamic = LoadControl("Controls/BkCode.ascx")
Me.PlaceHolderForm.Controls.Add(UCDynamic)
End if

Then on the ButtonClick Event for Submit I do this

Protected Sub Save_OnClick(ByVal sender As Object, ByVal e As EventArgs)
Save()
End Sub

[code]....

Thats where I get the cast Null reference error. So is it that after post back the control no longer exist on the page.

View 2 Replies

Exception Handling In Property For Ambiguously Typed Data Coming From Web Service?

May 7, 2009

I need to consume data from a webservice. I am receiving xml data and using this to create objects through property setters.

In one particular case, an attribute of the object (called "is_active" and indicates whether the object is active or inactive in the application) is represented sometimes by

<field type="BooleanField" name="is_active">1</field>

and at other times by <field type="BooleanField" name="is_active">True</field>

The client code requires me to represent this using integers 1 and 0. The returned string "True" or "False" results in System.FormatException, as expected.

What is the most graceful way to deal with this situation?

View 1 Replies

Office Automation :: Excel Throws Exception In Set_Calculation(Calculation Property)?

Jun 17, 2009

Error: System.Runtime.InteropServices.COMException (0x800A03EC): Exception from HRESULT: 0x800A03EC is thrown after execeution of Microsoft.Office.Interop.Excel.ApplicationClass.set_Calculation(XlCalc ulation RHS)

Out of nowhere COM start throwing exception when I set change excel's Calculation property. Line of code that followed set_Calculation was.Workbooks._Open. This used to cause exception every second try. Than I changed order, first open workbook and than set calculation property. Amount of exceptions start decreasing than I added thread.sleep(200) and exception is not thrown anymore. This happens only on one some of user machines while others are fine.Application itself is single threaded so this delay should be of importance if and only if set_Calculation is executed asynchronously. What I'm missing here?

[Code]...

View 6 Replies

Asp.net - Arabic Date Displaying Incorrectly

Mar 21, 2011

I'm using the following code to display an arabic date:

[Code]....

Today this is displaying as 161432. However, according to a user, the arabic text should be in the middle with the year 1432 at the end. However, when you highlight the text, it highlights back to front.

View 1 Replies

Dataset Query Validates Incorrectly

Sep 8, 2009

I have a data table in my dataset which was created with the following script.[code]

View 6 Replies

VS 2005 DrawImage Scales Incorrectly

Jul 18, 2010

Basically, what I am trying to do is scale part of an image. In VB6 the Scaling version of the BITBLT api worked fine, however in .NET's Drawimage version of it works okay, until a different destination size is specified.url...The red is from the next tile on the source image. and the bottom is missing one row of pixels.I have also screened this, and counted that the left side isn't properly doubled and the very first column of pixels is in 1x1 squares instead of 2x2 like the rest of the image.I don't get why it's obtaining outside the range I set, so here is my code incase it helps, note that you'll need to define a blocks array:[code]

View 3 Replies

Catch An Exception And Throw A New Exception Which Wraps The First Exception As An Inner Exception

May 8, 2009

It is possible to catch an exception and throw a new exception which wraps the first exception as an inner exception: [URL] Also, if I call a function and it throws a certain error, but I catch it, will the calling code's catch handler execute? If so, and it is of a higher exception type, is this not wrapping the exception? eg I can throw exception ex of type IndexOutOfRange, log it but rethrow, catch a higher up exception and do something, or I can throw a new exception and wrap an inner exception like:

View 1 Replies

Arabic CultureInfo.NativeName() Showing Incorrectly For AR-EG?

Nov 15, 2010

See graphic.Is this right? (Top is what I am seeing, bottom is what I expected to see.) Do I just really not understand Arabic culture and ways, or is there something wrong here?

View 2 Replies

Asp.net - Downloaded Word File Displaying Incorrectly?

Nov 5, 2009

I am working on a website at the moment which is displaying a strange bug with generated word documents. The site has a feature on it which allows the user to download a word document containing information related to their visit. This file is generated via some vb.net code and takes an xml template of the final document and inserts the relevant content required.

The strange behaviour is that on some machines the .doc file generated displays fine and on others it displays as XML when opened in Word. Both behaviours have been seen in the same version of Office (2003) but on seperate machines. My question is really whether the error lies with the set up of word on the individual machines, or whether there is an error in the code.

The code to create the file and download it is as follows:

Response.Clear()
Response.ClearHeaders()
Response.AddHeader("content-disposition", "inline; filename=MyNewFile")
Response.ContentType = "application/msword"

[code]....

View 4 Replies

Dataset Merging Sorts Records Incorrectly?

Feb 4, 2011

I have a temp dataset (ds) that I load with data from a filtered dataset. I run this in a loop essentially populating the temp dataset with select records from the main dataset. I then merge the temp dataset back to the main dataset (dsSpecifics). The issue I am running into is that the records are loaded into the temp dataset in the way they were merged. record 1 is at row 0, record 2 is at row 1 and so on. When I merge the ds back to dsSpecifics, they load out of order but in a predictable way. Here is a snipit of the code:

myAircraft.Reset()
While myAircraft.MoveNext()
Me.TblAircraftSpecificTableAdapter.FillBy(Me.DsSpecifics.tblAircraftSpecific, CInt(myAircraft.Key.ToString))

[Code].....

It seems that after the final merge, the merge starts with the last record of ds and and then rolls over to record position 0.

View 1 Replies

MDI Parent Client Size Calculates Incorrectly?

May 4, 2010

[URL]...The link above is a thread showing the application I'm working on. (2008 Pro)I have since created an MDI Parent form which holds my 16 camera forms. What I am having trouble with is dividing the MDIParent's Width and Height by 4, to display 4 equal height/width camera forms within it.

I've tried all the available properties (Rectangle, ClientArea, etc) and none seem to calculate correctly.Using Me.Width and Me.Height ALMOST worked, but again, it was about an inch too skinny and short.

What do I need to do in order to retrieve the exact size of the MDIParent's Client Area?

View 6 Replies

Opening And Closing ODBC Connection Incorrectly?

Dec 9, 2009

When connecting to a Sybase ASE database via ODBC using the code below, I'll occasionally get a '[IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed' error. this be caused by my code? I read here that I should be using the 'With' statement instead, but I don't understand how that would affect this.

[Code]...

View 1 Replies

VS 2010 Button Image Incorrectly Displayed

Mar 5, 2011

I have 2 buttons, named: 'Select item 1' and 'Select item2' to these buttons I have added images. how? when the form loads I execute this

Private Sub LoadButtonImages()
btnCompare1.Image = My.Resources.close1
btnCompare1.ImageAlign = ContentAlignment.MiddleLeft

[Code]....

when I test the program on my friend's pc it gives an error and does not display the image. ( and yes I already tried putting the executable in exactly the same folder as it is on my pc WITH the image folder.. )

so is there any way to use the first method of loading the images and ensuring the size is correctly? Ive added 2 screenshots to show you what I mean by incorrect size..

View 2 Replies

[2008] Labels Displaying Incorrectly On Other Machines

Feb 25, 2009

I've nearly finished my latest project (VB 2008 Express Edition) I built the project and ran the .exe from inRelease and it appears and works exactly as it did in Visual Basic

When I carry this .exe to any other computer, it displays differently. The biggest difference is the font size in labels (grows on other machines) and the size of the tabcontrol is a bit larger on other machines. see the links below for comparison (coding machine vs other machine) [URL]

note that both machines were set at the same screen resolution, both were using the default Windows XP "Theme" and display fonts appear to be set the same on both machines. I've tried this on about 3 other XP machines with the same result (only looks correct on the machine I coded on)

I've specifically used Microsoft Sans Serif font, size 8 (VB seems to display this as 8.25pt in the properties window) I have also tried making all labels "UseCompatibleTextRendering" both true and false with the same result. Perhaps something on the original (programming) machine is different that is throwing this off? Am I missing a step when building this project? If other encounter this problem often, what steps do you take (when programming) to avoid this and allow the form(s) to display correct regardless of the user's settings?

Edit: One difference can be found in (Right Click on Desktop -> Properties -> Settings Tab -> Advanced Button) the DPI Setting on the coding machine is Normal Size (96 DPI) The DPI on the other computers is Large Size (120 DPI)

The application will be used by roughly 100 folks on various systems (some Windows ME, most XP). How can I prevent things from going crazy with different user settings?

View 2 Replies

Excel Copys Form One Book But Paste Incorrectly To The Other?

Jun 14, 2009

I am working in VB.net 2008. I have a Window application that will be used to eliminate a lot of manual copy and paste activates from one work sheet to anther. Workbook 1 (wbMatrix)Never has the same layout twice. The destination Workbook2(wbTemplateSAS)has a defined layout that remains constant. To collect the copy ranges the user pouplates the text box on the form. Only the textbox that need popualted. There are 16 total. These textbox values are then concantianted to create the range. This process is intiated with button click.

When itinated the copy and paste works but not as expected. Cell.text range paste correctly In A9, OEC range paste correctly in P9. After that it skips the next colume as it should. Then in colume R9 the error starts the a paste of the range A10:B10 form wbMatrix is pouplated in R9:S9 Then It paste accoring to the application T9. Then in U9:X9 it paste date for wbMatrix A10:D10. It paste correctly again in Z9. it has the same error agiain till the next Range. It then paste correctly in 9AD. This should be the last paste that have values entered in the textbox to create the range. But it does not finish it paste the balnce of the cells form wbMartix on wbTempateSAS.

To sumerize above
wbMatrix Paste to wbTemplateSAS
First Row =10
Last Row = 158

[code]....

View 1 Replies

IDE :: Clickonce Deployment - Report Viewer Deploys Incorrectly?

Oct 24, 2008

I have an application that I'm deploying using Clickonce that includes the Report Viewer. On my development machine, the reports work perfectly. However, on client machines, the reports are having printing problems. On some machines, the first print sends a 2 page document to a printer that displays an error message. On those machines, printing the second time is successful. On other machines, the first attempt doesn't get sent to the printer at all. Subsequent attempts work just fine.This happens each time a form with the report viewer is displayed - the user must print twice to get a correct print-out of the report.

NOTE: if I create a network shortcut to the application for a user that has NOT installed the Clickonce app, they are able to print from the Reportviewer without any issues. However, once they install the Clickonce app, the Reportviewer is "broken" (for lack of a better word) and won't print on the first attempt in ANY application.I know that I probably need to do something in my Publish settings to force the correct, newer version of the Reportviewer to be installed, but I can't figure out what that is.

I have Microsoft Visual Studio 2005 Reportviewer selected in the Prerequisites list, and there are 4 Reportviewer files in the Application Files list:Microsoft.ReportViewer.Common.dll - Prerequisite (Auto)Microsoft.ReportViewer.ProcessingObjectModel.dll - Prerequisite (Auto)Microsoft.ReportViewer.WinForms.dll - Prerequisite (Auto)Microsoft.ReportViewer.WinForms.xml - Exclude (Auto)?

View 1 Replies

Export From DataGridView To Excel Resulting In Incorrectly Formatted Dates

Jul 27, 2011

I'm exporting a datagridview to excel. The first column is a Date (not DateTime) which appears like '2/15/2011'. After exporting the datagridview to excel it appears in excel as '2/15/2011 0:00', furthermore the first 68 rows in excel appear as '6/14/1898 12:00:00 AM'. Where is the time coming from? The column type in the database is date. I've attempted to edit the cell style of the datagridview column to date. I've attempted to figure out how to pre-program the formatting in excel, but it's not working either.

Dim wapp As Microsoft.Office.Interop.Excel.Application
Dim wbook As Microsoft.Office.Interop.Excel.Workbook
Dim wsheet As Microsoft.Office.Interop.Excel.Worksheet

[Code]....

View 1 Replies

VS 2010 Vs2010 Incorrectly Creating Control Event Code?

Apr 14, 2011

i recently received a new work pc and have installed visual studio 2010 premium on it. this was installed on my old machine as well, the only differece between the two PCs being my old one was 32bit and the new one is 64bit.With that said, when i create a windows form project and drop a control on a form, double click that control, the default event code is created for me.It is missing the "ByVal" portion of the code. Using a textbox as an example, below is the code it generates. Is there a setting that I'm just missing and need to turn on? I've been using visual studio since version 2005 and i've never seen this before.

Private Sub TextBox1_TextChanged(sender As System.Object, e As System.EventArgs) Handles TextBox1.TextChanged
End Sub

View 3 Replies

VS 2008 - Get The Caption Property Of Serial Ports Available On Computer - Error "A First Chance Exception Of Type 'System.InvalidCastException"

Nov 12, 2009

In my project I'm trying to get the caption property of serial ports available on computer. But when I run this code below I get "A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll" exception. I tried putting "Option Strict On" and then I'm getting build error saying it disallows Late binding.

[Code]...

View 5 Replies

What's The Best Way For A C# Developer To Learn VB?

Mar 26, 2009

I'm a C# programmer who needs to pick up some VB. The syntax differences are easy enough to figure out, but there are other things I'll need more of a tutorial on. For example, VB's "strict" mode in Visual Studio is something essential to me, but something I wouldn't have learned just by comparing language syntax. Any recommendations on how to pick up VB quickly, yet thoroughly? I can't stand to work through a 1000 page book introducing VB to novices.

View 10 Replies

Cannot Execute Exe On Machines Other Than The Developer?

Jul 19, 2011

I updated a VB.NET application from Visual Studio 2008 to Visual Studio 2010 and made a few changes to it. Now it works fine on my development workstation but when the user tries to run it, it fails. The error detail is below. I've searched for System.InvalidOperationException and found several suggestions but none of them have helped. There isn't any static initialization code in the application. I changed the compilation to x86 instead of AnyCpu. None of these has helped. The project is compiled for .NET 3.5 and that hasn't changed. Both environments are Windows 7 64-bit.

Does anyone have a suggestion as to how I might determine what is causing this?

[Code]...

View 6 Replies

Creating New Application With VB Web Developer?

Apr 20, 2009

I'm creating new application with visual basic web developer i have 3 textbox on web form ajax this is code inside event load

Dim Connection As SqlConnection
Dim Command As SqlCommand
Dim dr As SqlDataReader

[code]....

View 5 Replies

Download The Developer Tools?

Nov 9, 2011

I have been trying to download the Visual Basic and it took me 3 days now to download because my network is not always good, so when the net is off, I have to start it over and over again. My question is: How can I download the Visual Basic just once and for all so that I start learning how to build my first Windows Applications?

View 3 Replies

Store Password, Even The Developer Can't See It?

Jul 8, 2009

I went for an interview last week, and the interviewer asked me a question that i failed to answer.

He asked me, how did i store the password in the database. Then i answered that i would encrypt it then store it in database.

Then he said after encryption, developer or admin still able to view the encrypted password. But he didn't want developer or admin to be able to view the encrypted password.

I thought of cookies, but if user clear their cookies file, everything will be gone.

View 7 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved