Problem with Text Format

4 posts, 0 answers
  1. Fabien
    Fabien avatar
    43 posts
    Member since:
    Sep 2008

    Posted 21 Nov 2008 Link to this post

    Hi,

    I need to use this mask '##0.#'
    So if I launch my application it will display '___._'. That's correct.

    The problem is when I change the Value.

    By default : (on debug)
      this.RadMaskedEditBox_Test.Mask "##0.#" string
      this.RadMaskedEditBox_Test.Value "" object {string}
      this.RadMaskedEditBox_Test.Text "___._" string

    Value to set :
      Singleton.Instance.MarketGrowthRate 1.4 decimal

     


    this
    .RadMaskedEditBox_Test.Value = Singleton.Instance.MarketGrowthRate.ToString(this.RadMaskedEditBox_Test.Mask);  
     

     

     

     


    After this code :
      this.RadMaskedEditBox_Test.Value "14" object {string}
      this.RadMaskedEditBox_Test.Text "14_._" string
    It doesn't set 1.4 in the value and "__1.4" in the text.

    And I can't use something like n1 because I must have a maxlength. (999.9)

    Thanks for your help



     

  2. Fabien
    Fabien avatar
    43 posts
    Member since:
    Sep 2008

    Posted 21 Nov 2008 Link to this post

    I discovered an other problem with events:

     

    // Not fired  
    this.RadMaskedEditBox_Test.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.RadMaskedEditBox_Test_KeyPress);     
    this.RadMaskedEditBox_Test.KeyUp += new System.Windows.Forms.KeyEventHandler(this.RadMaskedEditBox_Test_KeyUp);   
     
    /* Not cancelled */   
    private void RadMaskedEditBox_Test_ValueChanging(object sender, System.ComponentModel.CancelEventArgs e)  
    {  
     if (RadMaskedEditBox_Test.Text.Length > 13)  
     e.Cancel = true;  
    }  
      

     

    it's not working...

     

     

     

     

     

  3. UI for WinForms is Visual Studio 2017 Ready
  4. Fabien
    Fabien avatar
    43 posts
    Member since:
    Sep 2008

    Posted 21 Nov 2008 Link to this post

    I didn't find a way to resolve the Mask problem but... I found a way to catch the Keypress event.

    on form constructor :

     

     

     
    this.RadMaskedEditBox_Test.MaskedEditBoxElement.TextBoxItem.KeyPress += new KeyPressEventHandler(RadMaskedEditBox_Test_KeyPress);   
     
     

     

     

    and 

     

     

    private void RadMaskedEditBox_Test_KeyPress(object sender, KeyPressEventArgs e)   
    {  
     if (this.RadMaskedEditBox_Test.Text.Length == 5)   
      e.Handled = true;   
    }  
     
     

     

     

  5. Boyko Markov
    Admin
    Boyko Markov avatar
    610 posts

    Posted 24 Nov 2008 Link to this post

    Hi Fabien,

    I wasn't able to reproduce the issue with the ValueChanging event. Here is the code I used:

    1. this.radMaskedEditBox1.ValueChanging += new CancelEventHandler(radMaskedEditBox1_ValueChanging);
       
    2. void radMaskedEditBox1_ValueChanging(object sender, CancelEventArgs e)
            {
                e.Cancel = true;
            }

    When I set the Cancel property to true, the editing is being canceled. The maskType property is Standard. Could you please give me more detailed instructions on how to replicate the reported bug?

    I'm looking forward to your reply.


    Kind regards,
    Boyko Markov
    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top