随笔分类 -  C#

1
For learning
Random 项目总结 -12 定义定时器,绑定事件
摘要:System.Windows.Forms.Timer timer1 = new System.Windows.Forms.Timer(); System.Windows.Forms.Timer timer2 = new System.Windows.Forms.Timer(); SqlConnect 阅读全文
posted @ 2024-04-20 22:30 Lionever 阅读(10) 评论(0) 推荐(0) 编辑
Random 项目总结 -11 产生随机数字
摘要:public void callback2(object sender, EventArgs e) { Random ran = new Random(); int rt = ran.Next(1, 101); // 含下线不含上线 label1.Text = rt.ToString(); } 阅读全文
posted @ 2024-04-20 22:26 Lionever 阅读(2) 评论(0) 推荐(0) 编辑
Random 项目总结 -10 响应快捷键
摘要:protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { //if (keyData == Keys.Left) //{ // this.button1.PerformClick(); // //this.btnTe 阅读全文
posted @ 2024-04-20 22:20 Lionever 阅读(3) 评论(0) 推荐(0) 编辑
Random 项目总结 -09 窗体关闭退出
摘要:private void result_FormClosing_1(object sender, FormClosingEventArgs e) { System.Environment.Exit(0); } 阅读全文
posted @ 2024-04-20 22:19 Lionever 阅读(3) 评论(0) 推荐(0) 编辑
Random 项目总结 -08 生成WORD 报告
摘要:using System.Windows.Forms;using System.Xml; using Msword = Microsoft.Office.Interop.Word; private void dy_Click(object sender, EventArgs e) { Form f1 阅读全文
posted @ 2024-04-20 22:15 Lionever 阅读(6) 评论(0) 推荐(0) 编辑
Random 项目总结 -07 截取当前程序图片
摘要:[DllImport("gdi32.dll", CharSet = CharSet.Auto, SetLastError = true, ExactSpelling = true)] public static extern int BitBlt(HandleRef hDC, int x, int 阅读全文
posted @ 2024-04-20 22:13 Lionever 阅读(4) 评论(0) 推荐(0) 编辑
Random 项目总结 -06 定时器、 随机数,截图,生成WORD报告 (result完整)
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Drawing.Imaging;using Sy 阅读全文
posted @ 2024-04-20 21:56 Lionever 阅读(7) 评论(0) 推荐(0) 编辑
Random 项目总结 -05读取XML信息
摘要:public void main_Load(object sender, EventArgs e) { string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml"; XmlDocument docx = 阅读全文
posted @ 2024-04-20 21:37 Lionever 阅读(4) 评论(0) 推荐(0) 编辑
Random 项目总结 -04设置项目项目写入XML,,调用exe
摘要:Process pro = new Process(); string propath = System.AppDomain.CurrentDomain.BaseDirectory; string t_data = ""; string t_sa = ""; string t_pwd = ""; p 阅读全文
posted @ 2024-04-20 21:33 Lionever 阅读(4) 评论(0) 推荐(0) 编辑
Random 项目总结 -03测试链接按钮 测试数据链接
摘要:注意: 如果填写地址 是指定端口 IP地址与端口之间需要用逗号隔开。 private void button2_Click(object sender, EventArgs e) { string strdata = textBox1.Text; string strsa = textBox2.Te 阅读全文
posted @ 2024-04-20 19:21 Lionever 阅读(6) 评论(0) 推荐(0) 编辑
Random 项目总结 -02设置按钮 设置数据库地址, 用户密码写入XML
摘要:private void button1_Click(object sender, EventArgs e) { string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml"; XmlDocument xm 阅读全文
posted @ 2024-04-20 19:18 Lionever 阅读(3) 评论(0) 推荐(0) 编辑
Random 项目总结 -01登录按钮 读取XML文件判断用户、密码是否正确
摘要:一、登录按钮 private void button1_Click(object sender, EventArgs e) { string xmlpath = System.AppDomain.CurrentDomain.BaseDirectory + "setting.xml"; XmlDocu 阅读全文
posted @ 2024-04-20 19:15 Lionever 阅读(9) 评论(0) 推荐(0) 编辑
sql 链接数据库指定实例
摘要:127.0.0.1 \mssql 阅读全文
posted @ 2023-01-04 21:38 Lionever 阅读(22) 评论(0) 推荐(0) 编辑
添加程序到开机自动启动
摘要:/// <summary> /// 将本程序设为开启自启 /// </summary> /// <param name="onOff">自启开关</param> /// <returns></returns> public static bool SetMeStart(bool onOff) { b 阅读全文
posted @ 2020-07-16 20:55 Lionever 阅读(401) 评论(0) 推荐(0) 编辑
在网络共享服务器上创建共享文件夹。
摘要:public static bool cdir(string xmmc) { bool flag = false; DirectoryInfo aimpath = new DirectoryInfo(@"\\192.168.1.217\共享文件夹 "); if (connectstat(aimpat 阅读全文
posted @ 2019-12-29 15:09 Lionever 阅读(933) 评论(0) 推荐(0) 编辑
C# SQL 增 删 改 查
摘要:一、查 SqlConnection conn = new SqlConnection(); conn.ConnectionString = sqlb.ConnectionString; conn.Open(); string sqlstr=""; SqlDataAdapter adap = new 阅读全文
posted @ 2019-12-29 15:05 Lionever 阅读(2653) 评论(0) 推荐(0) 编辑
C# DataGridView 与 datatable 之间数据传递
摘要:一、 DATAGRIDVIEW 数值传递给datable int cn = dataGridView1.Rows.Count; int col = dataGridView1.ColumnCount; for (int j = 0; j < col;j++ ) { DataColumn dc = n 阅读全文
posted @ 2019-12-29 14:55 Lionever 阅读(4527) 评论(0) 推荐(0) 编辑
C# 调用命令行命令 net use
摘要:bool flag = false; Process pro = new Process(); try { pro.StartInfo.FileName = "cmd.exe"; pro.StartInfo.UseShellExecute = false; pro.StartInfo.Redirec 阅读全文
posted @ 2019-12-29 14:48 Lionever 阅读(2056) 评论(0) 推荐(0) 编辑
C# 链接 sql server 数据库字符串
摘要:SqlConnectionStringBuilder sqlb = new SqlConnectionStringBuilder(); sqlb.DataSource = "ip address"; sqlb.InitialCatalog = "databasename"; sqlb.UserID 阅读全文
posted @ 2019-12-29 14:45 Lionever 阅读(403) 评论(0) 推荐(0) 编辑
根据EXCEL模板生成EXCEL ,指定单元格值
摘要:using Autodesk.AutoCAD.ApplicationServices; using Autodesk.AutoCAD.DatabaseServices; using Autodesk.AutoCAD.EditorInput; using System; using System.Collections.Generic; using System.ComponentModel; u... 阅读全文
posted @ 2018-12-04 17:28 Lionever 阅读(448) 评论(0) 推荐(0) 编辑

1