随笔分类 -  C#

C# 用户控件调用主窗体的方法(简单的线程用法)
摘要://在用户控件中写的方法() private void GoToSelectedTab() { var m = Page.GetType().GetMethod("SetPageTab"); if (m != null) { m.Invoke(Page, new... 阅读全文
posted @ 2017-03-02 11:14 zishen 阅读(2686) 评论(0) 推荐(0)
NPOI 导出Excel
摘要:调用的方法: 要添加的引用: 阅读全文
posted @ 2017-02-07 16:30 zishen 阅读(788) 评论(0) 推荐(0)
C# 窗口无假死,进度条
摘要:DataTable table; int currentIndex = 0; int max = 10000; private void button1_Click(object sender, EventArgs e) { buttonOK.Enabled = false; ... 阅读全文
posted @ 2016-11-16 17:33 zishen 阅读(3460) 评论(1) 推荐(0)
C# 调用BarTender模板 打印
摘要:/// <summary> /// 调用BarTender打印,模板的变量为:barcode0,barcode1,barcode2.......,barcode7 (内循环打印集合列表) /// </summary> /// <param name="pPrinter">打印机名称,必填</para 阅读全文
posted @ 2016-09-22 14:51 zishen 阅读(11523) 评论(17) 推荐(0)
C# 数字大写转换
摘要:private void button1_Click(object sender, EventArgs e) { textBox2.Text = ConvertNumberToChinese(Convert.ToDouble(textBox1.Text)); } /// <summary> /// 阅读全文
posted @ 2016-09-22 14:50 zishen 阅读(848) 评论(0) 推荐(0)
C# 获取字符串的字节数
摘要:System.Text.Encoding.Default.GetByteCount("博客").ToString(); 阅读全文
posted @ 2016-09-22 14:49 zishen 阅读(4896) 评论(0) 推荐(0)
C# 选择文件夹,遍历文件夹,复制图片并改名,读写XML
摘要:private void button2_Click(object sender, EventArgs e) { XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load("FilePath.xml"); XmlNodeList xn = xmlDoc. 阅读全文
posted @ 2016-09-22 14:48 zishen 阅读(1335) 评论(0) 推荐(0)
C# 错误日期格式转正确日期格式
摘要:private void button1_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(textBox1.Text)) { string newDate; ConvertDate(textBox1.Text, out ne 阅读全文
posted @ 2016-09-22 14:47 zishen 阅读(1962) 评论(0) 推荐(0)
C# 生成缩略图
摘要:/// <summary> /// 生成缩略图 /// </summary> /// <param name="serverImagePath">图片地址</param> /// <param name="thumbnailImagePath">缩略图地址</param> /// <param na 阅读全文
posted @ 2016-09-22 14:30 zishen 阅读(230) 评论(0) 推荐(0)
C# 保存byte[]到数据库和读取,把byte[]写进文件文件中
摘要:只能用参数传值的方式才能把byte[]的内容保存到数据 数据库中的字段类型为: varbinary /// <summary> /// 保存模板 /// </summary> /// <param name="t"></param> /// <returns></returns> public st 阅读全文
posted @ 2016-09-22 14:30 zishen 阅读(12599) 评论(0) 推荐(0)
C# 子窗体在父窗中间
摘要://在主窗口中的事件 private void 单据管理toolStripMenuItem_Click(object sender, EventArgs e) { try { this.winPanen.Controls.Clear(); CheckBillForm form = new Check 阅读全文
posted @ 2016-09-22 14:28 zishen 阅读(1231) 评论(0) 推荐(0)
C# 按指定(字节)长度截取字符串
摘要:/// <summary> /// 按指定(字节)长度截取字符串 /// </summary> /// <param name="str">源字符串</param> /// <returns>string</returns> private string CutStringByte(string s 阅读全文
posted @ 2016-03-30 17:39 zishen 阅读(6044) 评论(0) 推荐(0)
C#获取当前日期时间(转)
摘要:http://blog.163.com/ljq086@126/blog/static/549639712010112921658843/我们可以通过使用DataTime这个类来获取当前的时间。通过调用类中的各种方法我们可以获取不同的时间:如:日期(2008-09-04)、时间(12:12:12)、日... 阅读全文
posted @ 2015-12-15 10:57 zishen 阅读(255) 评论(0) 推荐(0)
EF 使用SQL查询
摘要:public List UserInfo_SearchList(ref int total, int page, int rows, string userId, string userName){SqlParameter[] sqlParam = new SqlParameter[1];strin... 阅读全文
posted @ 2015-11-19 22:34 zishen 阅读(2266) 评论(0) 推荐(0)
C# SQL增删查改
摘要:DBHelper: /// /// 执行查询 /// /// 有效的select语句 /// 返回SqlDataReader public static SqlDataReader ExecuteReader(strin... 阅读全文
posted @ 2015-11-19 21:21 zishen 阅读(479) 评论(0) 推荐(0)
params关键字
摘要:每个C#函数都允许有个参数带params关键字,在调用的时候可以不给他传值,也可以给他传值,还可以给他传多个值注意事项:·一个函数中只能一个参数带params关键字;·带params关键字的参数必须是最后一个参数;·带params关键字的参数类型必须是一维数组;class aaa{static vo... 阅读全文
posted @ 2015-11-19 21:14 zishen 阅读(162) 评论(0) 推荐(0)