![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
VS
iteye_18296
这个作者很懒,什么都没留下…
展开
-
C#配置文件(App.config)
以下代码配置在App.config中<?xml version="1.0" encoding="utf-8"?><configuration> <configSections> </configSections> <connectionStrings> //Data Sour2016-01-12 09:44:20 · 386 阅读 · 0 评论 -
C#获取当前时间戳
TimeSpan tss = DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, 0);long a = Convert.ToInt64(tss.TotalMilliseconds);2016-01-27 09:48:55 · 238 阅读 · 0 评论 -
C#使用PDF控件打开PDF
private void button2_Click(object sender, EventArgs e) { if (pdfpath.Equals("")) { MessageBox.Show("请先选择要查看的文件", "信息提示", MessageBoxButtons...原创 2016-01-20 09:42:48 · 2356 阅读 · 0 评论 -
C#用正则表达试判断是否为数字
public Boolean isnum(string value) { System.Text.RegularExpressions.Regex rex = new System.Text.RegularExpressions.Regex(@"^\d+$"); int result = -1; ...2016-01-15 16:12:15 · 191 阅读 · 0 评论 -
C#调用扫描仪(keda控件)
1.选择扫描仪 axImgScan1.ShowSelectScanner();2.调用扫描仪 if (axImgScan1.OpenScanner() == 0) { if (axImgScan1.ScannerAvailable() == true)//...2016-01-15 16:08:23 · 2878 阅读 · 0 评论 -
C#中一个简单的递归(查看文件总个数)
//总共多少个文件 public int allfilenum(string filepath) { DirectoryInfo dir = new DirectoryInfo(filepath); FileInfo[] fis = dir.GetFiles(); i...2016-01-15 15:54:18 · 269 阅读 · 0 评论 -
C#中的进度条
进度条,很简单的 progressBar1.Maximum = 5;//最大值 progressBar1.Value = 0;//开始值 for(int i=0;i<6;i++){ progressBar1.Value++; //为看出效果可以加个 ...2016-01-15 15:53:06 · 148 阅读 · 0 评论 -
C#中的线程
C#中的无参线程 Control.CheckForIllegalCrossThreadCalls = false; Thread t = new Thread(saomiao); t.Start();2016-01-15 15:43:55 · 104 阅读 · 0 评论 -
C#窗体对话框(提示框、确认框)
1.提示框MessageBox.Show("信息", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); 2.确认框 DialogResult dr = MessageBox.Show("确定删除当前文件?", "提示", MessageBoxButtons.OKCancel, MessageBox...原创 2016-01-14 10:09:56 · 6927 阅读 · 0 评论 -
C#中可搜索下拉框
1.给下拉框赋值 DirectoryInfo di = new DirectoryInfo(path + "xls\\干部人事档案目录"); foreach (FileInfo file in di.GetFiles()) { comboBox1.Items.Add(file.Nam...原创 2016-01-14 10:09:40 · 3290 阅读 · 0 评论 -
C#监听事件(窗体关闭、按键等)
1.监听窗体关闭事件(rslr_main为窗体名) public rslr_main() { InitializeComponent(); this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(Form_Closing);...原创 2016-01-13 15:18:07 · 3713 阅读 · 0 评论 -
C#中用listview显示列表
//干部人事档案目录列表 public void mulu() { this.listView1.Clear(); ColumnHeader ch = new ColumnHeader(); ch.Text = "干部人事档案目录文件列表"; //设置列标题...原创 2016-01-13 15:17:52 · 2019 阅读 · 0 评论 -
C#操作文件(复制、重命名、删除)
1.复制文件File.Copy(filepath, filepath1);将现有文件复制到新文件,不允许同名覆盖2.文件重命名FileInfo fi = new FileInfo(filepath1);fi.MoveTo(Path.Combine(filepath1, filepath));3.删除文件File.Delete(filepath);...2016-01-13 15:17:18 · 4483 阅读 · 0 评论 -
C#得到workspace(即程序)路径
哈哈,这个就一行,但是却是非常常用的,可声明为全局变量 private String path = AppDomain.CurrentDomain.BaseDirectory;2016-01-13 14:36:02 · 631 阅读 · 0 评论 -
C#WForm操作EXCEL
1.注册dsoframer.ocx,添加dsoframer的引用2.在窗体中加入DSO Framer Control Object3.声明以下变量 private String path = AppDomain.CurrentDomain.BaseDirectory; Boolean bOpen = false; Object re...2016-01-13 14:33:34 · 313 阅读 · 0 评论 -
C#与SQLServer
C#操作SQLServer string sql = "select * from " + damls[0] + " where ndu like '%" + textBox1.Text + "%' and jgname like '%" + textBox2.Text + "%' and qx like '%" + textBox3.Text + "...2016-01-12 10:33:42 · 121 阅读 · 0 评论 -
C#与EXCEL
1.配置EXCEL链接 public OleDbConnection getExcelConn(string filepath) { string strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filepath + ";Extended Properties='...2016-01-12 10:20:04 · 144 阅读 · 0 评论 -
C#与ACCESS
1.配置ACCESS链接 public class DataManagement { private static OleDbConnection connection; public static OleDbConnection Connection { get {...2016-01-12 10:06:44 · 122 阅读 · 0 评论 -
C#生成dll与调用
生成COM组件1.打开VS,[文件]->[新建]->[项目]->[类库]2.编辑新生成class代码,EGusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespac...2016-01-29 14:49:21 · 180 阅读 · 0 评论