Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Allow only numeric data in cell
Message
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Network:
Windows 2000 Server
Database:
MS SQL Server
Miscellaneous
Thread ID:
01052488
Message ID:
01052495
Views:
6
Tim,
I would probably use the KeyPressed event handler. Below is some code that would only accept numeric data (and the backspace)
private void txtNumeric_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
  if (!System.Char.IsNumber(e.KeyChar) && e.KeyChar != (char)System.Windows.Forms.Keys.Back)
  {
    e.Handled = true;
  }
}
I appologize that the code is C#, but it should be very easy to convert

Einar

>Is there an easy way to only allow the user to enter numeric data into a datagrid cell that is bound to a data table?
Semper ubi sub ubi.
Previous
Reply
Map
View

Click here to load this message in the networking platform