急求光标定位代码 当用户输入的数据部符合要求的时候,比如输入的数据长度不够或者不输入,因为他是主键,必须输入正确,如果输入不正确,就将光标始终定位在那个文本框中textbox里面。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 this.textBox1.LostFocus += new EventHandler(textBox1_LostFocus); } void textBox1_LostFocus(object sender, EventArgs e) { //判断.. bool flag = true; if (flag) { this.textBox1.Focus(); } } 先判断是否符合条件,然后textbox.focus(); textbox.focus();textbox..SelectAll(); private void button1_Click(object sender, EventArgs e){ textBox1.SelectionStart = 2; textBox1.Focus();}// 取得光标位置private void button2_Click(object sender, EventArgs e){ MessageBox.Show(textBox1.SelectionStart.ToString());} c#基础问题 问题又来了 谁能给一个.NET的WIN32 API包装类呢?内容全一点的。 求一个思路,急! 请问user32.dll提供哪些接口? 连接数据库的问题? 菜鸟问题,大家来看看。如何将一串字符串转成unicode字符 C#和word,excel问题,应该差不多,可是就是不太清楚,超级等待中 Excel导入SQL Server 求救!! 高手帮忙治下疑难杂症.急急急! ~~~~急~~~~网页上的TextBox 和 CheckBox 文件夹 加密问题
} void textBox1_LostFocus(object sender, EventArgs e)
{
//判断..
bool flag = true;
if (flag)
{
this.textBox1.Focus();
}
}
textbox.focus();
textbox..SelectAll();
{
textBox1.SelectionStart = 2;
textBox1.Focus();
}// 取得光标位置
private void button2_Click(object sender, EventArgs e)
{
MessageBox.Show(textBox1.SelectionStart.ToString());
}