静心

我是小明
  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

随笔分类 -  C#知识

摘要:在设置dgv的一行visiable=false时,如果该dgv是绑定的,则会提示“winform与货币管理器关联的行不能设置为不可见”,这时设置语句需要这样写:dgv.BindingContext[dgv.DataSource].SuspendBinding();dgv.Rows[i].Visible=false;dgv.BindingContext[dgv.DataSource].ResumeBinding(); 阅读全文

posted @ 2013-05-08 20:35 俗人一个 阅读(222) 评论(0) 推荐(0)

摘要:前台代码:protected void Button7_Click(object sender, EventArgs e) { DataTable dt = DataExport.GetDefenseStu();//dt是从后台生成的要导出的datatable string fileName = "二辩名单" + ".xls";//设置导出文件的名称 HttpContext curContext ... 阅读全文

posted @ 2010-04-14 21:40 俗人一个 阅读(2726) 评论(0) 推荐(1)

摘要:1、 Math.Round(0.333333,2); //按照四舍五入的国际标准  2、 double dbdata=0.335333; string str1=String.Format("{0:F}",dbdata);//默认为保留两位  3、 float i=0.333333; int j=(int)(i * 100); i = j/100;   4、 decimal.Round(decim... 阅读全文

posted @ 2010-04-14 21:33 俗人一个 阅读(2434) 评论(0) 推荐(0)

摘要:转载自:http://blog.sina.com.cn/s/blog_59181ec70100cf6u.html~type=v5_one&label=rela_nextarticleDataGridView中的ContextMenuStrip属性DataGridView指定滚动框位置DataGridView手动追加列DataGridView全体分界线样式设置DataGridView根据单元... 阅读全文

posted @ 2010-01-26 10:06 俗人一个 阅读(906) 评论(0) 推荐(0)

摘要:转载自:http://blog.sina.com.cn/s/blog_59181ec70100cf6l.html~type=v5_one&label=rela_nextarticleDataGridView指定单元格是否表示DataGridView表头部单元格取得DataGridView表头部单元格文字列设定DataGridView选择的部分拷贝至剪贴板DataGridView粘贴Data... 阅读全文

posted @ 2010-01-26 09:53 俗人一个 阅读(716) 评论(0) 推荐(0)

摘要:DataGridView行列宽度高度设置为不能编辑DataGridView行高列幅自动调整DataGridView指定行列冻结DataGridView列顺序变更可否设定DataGridView行复数选择DataGridView选择的行、列、单元格取得 1.DataGridView行列宽度高度设置为不能编辑 [VB.NET]'DataGridView1の列の幅をユーザーが変更できないようにするDat... 阅读全文

posted @ 2010-01-26 09:44 俗人一个 阅读(808) 评论(0) 推荐(0)

摘要:转载自:http://blog.sina.com.cn/s/blog_59181ec70100cel4.html~type=v5_one&label=rela_prevarticleDataGridView当前的单元格属性取得、变更DataGridView编辑属性DataGridView最下面一列新追加行非表示DataGridView判断当前选中行是否为新追加的行DataGridView删... 阅读全文

posted @ 2010-01-26 09:19 俗人一个 阅读(665) 评论(0) 推荐(0)

摘要:对于字符串s=“我是小明2010”,如果按int len=s.Length;来计算,得到len=8.如果想得到len=12,则这样写:byte[] sarr = System.Text.Encoding.Default.GetBytes(s);len = sarr.Length;//len=12 阅读全文

posted @ 2010-01-26 08:59 俗人一个 阅读(502) 评论(0) 推荐(0)

摘要:/**////<summary>///C#发送邮件(163邮箱)///</summary>///<paramname="MailFrom">邮箱用户名</param>///<paramname="MailTo">接收人用户名</param>///<paramname="MailPwd">邮箱密码</param... 阅读全文

posted @ 2009-11-10 14:36 俗人一个 阅读(140) 评论(0) 推荐(0)

摘要:1.获取CPU序列号:public string getCpu(){string strCpu = null;ManagementClass myCpu = new ManagementClass("win32_Processor");ManagementObjectCollection myCpuConnection = myCpu.GetInstances();foreach( Managem... 阅读全文

posted @ 2009-11-10 14:34 俗人一个 阅读(377) 评论(0) 推荐(0)

摘要:1.只能输入数字: private void textBox1_KeyPress(object sender, KeyPressEventArgs e) { if (!(((e.KeyChar >= '0') && (e.KeyChar <= '9')) || e.KeyChar <= 31)) { if (e.KeyChar == '.') { e.Handle... 阅读全文

posted @ 2009-07-22 15:44 俗人一个 阅读(1347) 评论(0) 推荐(2)