Good day to all. How to prevent OnKeyPress entering a particular character first? I need to prohibit the input of the first character point. Here is the code:

 if((Key >= '0' && Key <= '9') || Key == VK_BACK ||Key == '.' || Key == ',') { if(Key == ',') Key = '.'; } else Key = NULL; 

Still, how to prevent the input of two points in a row?
Thank.

    1 answer 1

    I don’t remember exactly how to get its content from a textbox, but the meaning should be clear. And, of course, this applies not only to textbox.

     if (textBox->Contents->Length == 0 && Key == '.') { Key = 0; } // Дальше уже обработка нормальных клавиш - то, что написано у вас. 
    • something my edith doesn't have Contents ( - chip
    • @ chip Well, I said I didn’t remember how it was there :) Maybe there, Text or something else. The same can be seen in the property editor . - Costantino Rupert
    • OnChange is that? it seems to work) - chip
    • oh no, not that :( - chip
    • SelStart !!! Thanks! - chip