void __fastcall TMain::edtPortKeyPress(TObject *Sender, char &Key)
{
if (((Key >= '0') && (Key <= '9')) || (Key == '\b'))
{
if ((Key >= '0') && (Key <= '9'))
{
if (StrToInt(edtPort->Text+Key) > 65535)
Key = 0;
}
}
else
{
Key = 0;
}
}
This is a Tang's thinking,doing,playing area.