C # Form Tips

Source: Internet
Author: User

Limit text boxes to enter only numbers and allow the backspace key to delete numbers, other keyboard inputs are not displayed
private void text Box name _keypress (object sender, KeyPressEventArgs e)
{
if (!char. Isnumber (E.keychar) && E.keychar! = (char) 8)
{
E.handled = true;
}
}

The ListView limit can only appear in a valid data record row that is queried for the right-click menu, and no other blank space appears
private void Right-click menu name _opening (object sender, CancelEventArgs e)
{
if (this.listview1.SelectedItems.Count <= 0)
{
E.cancel = true;
}
}

After the ListView has queried the data, the table immediately removes the data from the table by right-clicking the record.
ListView1. Items.remove (ListView1. Selecteditems[0])

C # Form Tips

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.