Click here to Skip to main content
15,893,668 members

Comments by abacrotto (Top 4 by date)

abacrotto 23-Aug-14 8:15am View    
Sergey, I was looking in the full code of the Project, as you said, for the words Parse, and I did not find too many:

1) My ClassExpeption.cs has TryParse calls for trying to convert string values to int, decimal, float, etc.


\WindowsFormsApplication3\ClassException.cs(64): else if (int.TryParse(strValue, System.Globalization.NumberStyles.Integer, null, out intValue))
\WindowsFormsApplication3\ClassException.cs(68): else if (decimal.TryParse(strValue, System.Globalization.NumberStyles.Float, null, out decimalValue))
\WindowsFormsApplication3\ClassException.cs(72): else if (float.TryParse(strValue, System.Globalization.NumberStyles.Float, null, out floatValue))
\WindowsFormsApplication3\ClassException.cs(76): else if (double.TryParse(strValue, System.Globalization.NumberStyles.Float, null, out doubleValue))
\WindowsFormsApplication3\ClassException.cs(80): else if (bool.TryParse(strValue, out boolValue))
\WindowsFormsApplication3\ClassException.cs(84): else if (DateTime.TryParse(strValue, out dateTime))

2) My Form1.cs has a little code of mine trying to handle the parsing, but it never stops there when I debug the program as you said.


\WindowsFormsApplication3\Form1.cs(42): this.bonoPagoBinding.Parse += bonoPagoBinding_Parse;
\WindowsFormsApplication3\Form1.cs(57): void bonoPagoBinding_Parse(object sender, ConvertEventArgs e)
\WindowsFormsApplication3\Form1.cs(68): bool parse = Decimal.TryParse(e.Value.ToString(), out value);
\WindowsFormsApplication3\Form1.cs(69): if (parse)

3) My DecimalTextBox.cs has only one explicit call to Decimal.TryParse, none yo Decimal.Parse.


\WindowsFormsApplication3\DecimalTextBox.cs(606): Decimal.TryParse(this.RealNumericText,System.Globalization.NumberStyles.Number, new System.Globalization.CultureInfo("en-GB"), out valor);

4) My DecimalTextBox.cs has this code below that allows for the HandleBindingParse (just like I did in Form1.cs). I took off the comments,


\WindowsFormsApplication3\DecimalTextBox.cs(1205): binding.Parse += new ConvertEventHandler(HandleBindingParse);
\WindowsFormsApplication3\DecimalTextBox.cs(1237): protected virtual void HandleBindingParse(object sender, ConvertEventArgs e)
\WindowsFormsApplication3\DecimalTextBox.cs(3033): protected override void HandleBindingParse(object sender, ConvertEventArgs e)


As there are no Decimal.Parse I understand there is no reason for the code to rise a conversion type exception.
It seems to me that inside the method System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value) occurrs the exception in

Excepción nivel (1):
Tipo de excepción:
System.ArgumentException
ArgumentException.ParamName:
Mensaje:
Object of type 'System.String' cannot be converted to type 'System.Decimal'.
Source:
System
TargetSite:
Void SetValue(System.Object, System.Object)
StackTrace:
at System.ComponentModel.ReflectPropertyDescriptor.SetValue(Object component, Object value)
at System.Windows.Forms.BindToObject.SetValue(Object value)
at System.Windows.Forms.Binding.PullData(Boolean reformat, Boolean force)
Datos adicionales:
Control.Name = 'textBoxPago'
Control.Type = 'WindowsFormsApplication3.DecimalTextBox'
PropertyName = 'Decimal'
FormatString = ''
FormattingEnabled = '1'
title = NULL

but, even when I try to debug with the .Net framework sources, that method is marked as 'Optimized' and Visual Studio debugger bahaves badly with
the code and does not show the Watch variables at all. So I tend to think the problem is with some property my DecimalTextBox control has (or hasn't)
but I don't realize what could it be.

I hope the description is good enough for you to understand. Otherwise, please, let me know.
Thanks a lot for taking the time to read and answer me.

Ariel.
abacrotto 22-Aug-14 9:16am View    
Sergey, I recently updated the problem description with (what I think) is the most specific description of my problem. The description includes the relevant lines where I bind the control to the problematic property and the steps I take to raise the exceptions. I hope it explains my problem better than before and it is more understandable.

Thanks a lot for taking the time to read my bad english.
Regards.
Ariel.
abacrotto 21-Aug-14 15:09pm View    
Sergey, can you tell me what other relevant information are you needing ? I think that if you compile the code I uploaded now (the new one does not have the binaries) and run it for a while you will see the exceptions thrown showing in MessageBoxes. My problem is I do not understand why they appear as they are thrown from the .NET Framework and not from my code. I will add a screen capture of one of such message boxes.

Thanks in advance.
Ariel.
abacrotto 21-Aug-14 15:04pm View    
You are right Wes. I will make that upload unavailable and upload a new one without the binaries. I did not know I should not upload binaries. Sorry for that.
The new link is
http://expirebox.com/download/c28bd7c959f26ce328bb4d26e16bddd1.html

Thanks for the advice.
Regards.
Ariel.