欢迎来到萧静默的博客

路勤为径,学海无涯苦作舟。书山有

随笔分类 -  C#

摘要:做项目过程中,导出项目碰到excel版本问题屡见不鲜,这个时候按照一般方法已经没办法解决了(个人水平有限),于是找度娘,发现有种NPOI导出excel的方法 就是引用NPOI.DLL,可以不管版本问题了。 完整代码如下,读取文件至datatable,再导出excel 路径读取: private vo 阅读全文
posted @ 2020-06-24 09:41 萧静默 阅读(507) 评论(0) 推荐(1) 编辑
摘要:1、读取路径按钮 private void button1_Click(object sender, EventArgs e)//选取文件 { OpenFileDialog openFileDialog1 = new OpenFileDialog(); if (openFileDialog1.Sho 阅读全文
posted @ 2020-06-23 17:35 萧静默 阅读(2907) 评论(0) 推荐(0) 编辑
摘要:解决方法:1、Ctrl+H,打开替换功能框。2、选择“使用正则表达式”,“当前文档”。3、在查找框中输入:(?<=\r\n)\r\n或者^:b*$/n:4、全部替换 阅读全文
posted @ 2020-06-23 16:43 萧静默 阅读(741) 评论(0) 推荐(0) 编辑
摘要:这篇文章主要介绍了C# Winform中实现主窗口打开登录窗口关闭的方法,这在需要用户名密码的软件项目中是必用的一个技巧,要的朋友可以参考下在使用C#进行Winform编程时,我们经常需要使用一个登录框来进行登录,一旦输入的用户名密码登录成功,这时登录窗口应该关闭,而且同时打开主程序窗口。该如何来实 阅读全文
posted @ 2020-06-16 15:36 萧静默 阅读(1093) 评论(0) 推荐(0) 编辑
摘要:第一种、首先本form上游datagridview的控件及数据,再建一个button控件作为导出按钮,在按钮click事件中写入以下代码 此乃数据集的方式,即先将数据放入数据集表里 作为对象与excel一一对应 //保存文件对话框 SaveFileDialog sfd = new SaveFileD 阅读全文
posted @ 2020-06-04 09:31 萧静默 阅读(10294) 评论(0) 推荐(4) 编辑
摘要:public static void main(String[] args) { int j = 3; for (int i = 0; i < 5; i++) { if (i == j) { return; } System.out.println("i = " + i); } System.out 阅读全文
posted @ 2020-06-01 08:50 萧静默 阅读(2207) 评论(0) 推荐(0) 编辑
摘要:1、点击视图,点击服务器资源管理 2、点击链接到数据库 3、在出来的界面中点击数据源,点击下图所示 4、选择数据库名等 服务器名在SQL看 这个字符串就是需要建立实例的参数 5、在click事件中可以这样写代码 SqlConnection comn = new SqlConnection("Data 阅读全文
posted @ 2020-05-26 14:21 萧静默 阅读(1652) 评论(0) 推荐(0) 编辑
摘要:直接上图 阅读全文
posted @ 2020-02-21 08:59 萧静默 阅读(1182) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System. 阅读全文
posted @ 2020-02-08 09:47 萧静默 阅读(563) 评论(0) 推荐(1) 编辑
摘要:using System; using System.Text.RegularExpressions;//用于Split using System.Collections.Generic; using System.ComponentModel; using System.Data; using S 阅读全文
posted @ 2020-02-06 20:50 萧静默 阅读(246) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System. 阅读全文
posted @ 2020-02-03 11:49 萧静默 阅读(332) 评论(0) 推荐(0) 编辑
摘要:设计一个简单的登录窗口,要求输入用户名:小金,密码:123456时候点登录能正确转到另一个窗口。 1、建立窗体应用。 2、这里创建一个login和一个NewForm的窗体。 3、在login的窗体拖拉2个label和2个textbox和1个linklabel的控件。一个标签名字为用户名,一个标签为密 阅读全文
posted @ 2020-01-16 09:11 萧静默 阅读(629) 评论(0) 推荐(0) 编辑
摘要:using System; namespace runoob { class MyClass { static void Main(string[] args) { MyClass1 myClass = new MyClass1(); myClass.Dialog(); } } class MyCl 阅读全文
posted @ 2020-01-10 11:27 萧静默 阅读(476) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Text; namespace HELLO { class 矩形 { static void Main(string[] args) { Example ex = new Exa 阅读全文
posted @ 2020-01-08 16:18 萧静默 阅读(345) 评论(0) 推荐(0) 编辑
摘要:C#中get和SET,看来看去还是看不懂,通俗一点解释一下,用了有什么好处,不用会怎么样如果你这样写是没有什么不一样的. private int __Old; public int Old{ get{return __Old;} set{__Old = value;} } 但是如果你这样写就不一样了 阅读全文
posted @ 2020-01-08 15:34 萧静默 阅读(686) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Text; namespace HELLO { class 矩形 { static void Main(string[] args) { Line line = new Line 阅读全文
posted @ 2020-01-08 14:33 萧静默 阅读(878) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Text; namespace 继承 { class Program { static void Main(string[] args) { Vertebrate vertebr 阅读全文
posted @ 2019-12-19 16:31 萧静默 阅读(356) 评论(0) 推荐(0) 编辑
摘要:Protected 在基类中定义后,能被派生类调用,但是不能被其他类调用。 virtual 在基类中定义后,在派生类中能被重写。 using System; using System.Collections.Generic; using System.Text; namespace 继承 { cla 阅读全文
posted @ 2019-12-19 15:26 萧静默 阅读(1075) 评论(0) 推荐(0) 编辑
摘要:using System; using System.Collections.Generic; using System.Text; namespace 继承 { class Program { static void Main(string[] args) { Mammal mammal = ne 阅读全文
posted @ 2019-12-18 17:20 萧静默 阅读(2410) 评论(0) 推荐(1) 编辑
摘要:using System; namespace test { class Program { static void Main(string[] args) { Cat cat = new Cat();//不含参数的构造方法 Console.WriteLine("姓名是{0},年龄是{1}",cat 阅读全文
posted @ 2019-11-19 17:19 萧静默 阅读(2173) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示