我的编码有一个错误,它真的开始变得困难了
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using Business_Card.Resources;
using Windows;
using Microsoft;
namespace Business_Card
{
public partial class MainPage : PhoneApplicationPage
{
// Constructor
public MainPage()
{
InitializeComponent();
// Sample code to localize the ApplicationBar
//BuildLocalizedApplicationBar();
}
private void TextBox_TextChanged_1(object sender, TextChangedEventArgs e)
{
}
private void TextBox_KeyPress(object sender, System.Windows.Input.KeyPressEventArgs e)
{
string[] nums = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-" };
if (!nums.Contains(e.KeyChar.ToString()))
e.Handled = true;
}
}
}
那是全班
但这是有错误的部分
private void TextBox_KeyPress(object sender, System.Windows.Input.KeyPressEventArgs e)
{
string[] nums = { "1", "2", "3", "4", "5", "6", "7", "8", "9", "0", "-" };
if (!nums.Contains(e.KeyChar.ToString()))
e.Handled = true;
}
具体线路
private void TextBox_KeyPress(object sender, System.Windows.Input.KeyPressEventArgs e)
它说System.Windows.Input.KeyPressEventArgs的部分告诉我在System.Windows.Input中找不到命名空间或名称
我也尝试过使用 System.Windows.Forms;它说也没有找到表格,我确实去了参考资料,但在那里没有找到。