利用KeyPress事件
private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{e.Handled=true;
}
或者定義類型爲:數值或空格標點等
private void comboBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
char c = e.KeyChar;
e.Handled = !(char.IsNumber(c) || char.IsWhiteSpace(c) ||
char.IsControl(c) || char.IsPunctuation(c));
}