retrieve value dynamically from sfnumerictextbox

Hello, i have a SfNumerictextbox with the name "eDose". i am trying to retrieve the value from code but i think there is a bug.
The control is initialized in xaml to the value 0.

I have a button that retrieve the value in this manner: double.Parse(eDose.Value.ToString());

1-If i don't enter any value in the control eDose and i click the button to retrieve the value, i get an exception.

2-If i click on the control but without entering any value, and click the button to retrieve the value , i get the value without exception.

What to do to retrieve the initial value (as in the scenario 1) without getting an exception?  

thank you
Best regards.

3 Replies 1 reply marked as answer

SS Sridevi Sivakumar Syncfusion Team July 22, 2020 07:37 AM UTC

Hi hassan salman, 

We have checked the reported issue by preparing the simple sample with setting the Value and getting that value through Button click as you did in below code snippet, that is worked fine at our end. 
  
 
 <StackLayout>        
 <Button Clicked="Button_Clicked"/>     
  <xforms:SfNumericTextBox x:Name="eDose" Value="0"/>  
 </StackLayout>


 
 
 
Possible testing cases to replicate the issue:

             Try with changing the ParserMode – Double with the suspecting on some conventional process may cause the issue. But that is worked at our end. 
             Another possible case is getting the exception only when having AllowNull property as True, without setting any value, it considered as null - > In that way, if you tried to convert that to double – will cause the issue.  
 

<xforms:SfNumericTextBox x:Name="eDose" AllowNull="True"/> 
 
 

 
 
Could you please confirm us whether did you enable the AllowNull property?  

 Or else can you please share the used code snippet along with tried Xamarin.Forms version and Syncfusion SfNumericTextBox NuGet version and  share the type exception along with its complete stack trace. 
 
Regards, 
Sridevi S. 
 


Marked as answer

HS hassan salman July 22, 2020 11:32 AM UTC

hello, thank you for your response. my code is similar to the yours. i closed visual studio and opened it. it works now.

thank you again.


SS Sridevi Sivakumar Syncfusion Team July 23, 2020 05:17 AM UTC

Hi  hassan salman, 
 
Thanks for your update.

Please let us know if you need any further assistance.

Regards,
 
Sridevi S. 


Loader.
Up arrow icon