摘要: this.dataGridView1.SelectionMode =DataGridViewSelectionMode.FullRowSelect;dataGridView1即你的dataGridView名称。 阅读全文
posted @ 2018-07-12 23:10 net-sky 阅读(14293) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Configuration; using System.Data; using System.Data.SqlClient; using System.Linq; using S 阅读全文
posted @ 2018-07-12 21:20 net-sky 阅读(1588) 评论(0) 推荐(0) 编辑
摘要: 1、首先先在工程里添加system.configuration.dll程序集的引用 //访问数据库连接字符串string connStr1 = System.Configuration.ConfigurationManager.ConnectionStrings["TQ电力.... 阅读全文
posted @ 2018-07-12 21:07 net-sky 阅读(1969) 评论(0) 推荐(0) 编辑
摘要: 方法一: private void tBox_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 0x20) e.KeyChar = (char)0; //禁止空格键 if ((e.KeyChar == 0x2D) && ( 阅读全文
posted @ 2018-07-12 20:53 net-sky 阅读(333) 评论(0) 推荐(0) 编辑
摘要: TextBox控件本身有个maxlength属性,它可以限制TextBox中输入字符的最大长度,所以在只有字符输入的情况下,该属性可以很好的帮助我们达到限制输入长度的目的。 但如果输入包含中文或中英文混合的内容时,该属性就不那么完善了 阅读全文
posted @ 2018-07-12 20:51 net-sky 阅读(3490) 评论(0) 推荐(0) 编辑