原创 c# 打開word文件
引用Microsoft Office 14.0 Object Library Microsoft Word 14.0 Object Library using MSWord = Microsoft.Office.Interop.Word;
原创 winform的一些小技巧
//進程延遲 System.Threading.Thread.Sleep(1010); //確認對話框 DialogResult clo = MessageBox.Show("是否確定XXXXXXX", "提示", MessageB
原创 WPF datagrid鼠標右鍵獲取行數據
private void RightClick(object sender, MouseButtonEventArgs e) { DataGrid g = sender as DataGrid; if (g.Contex
原创 datagridview顯示行號
添加datagridview的RowPostPaint事件。 private void dataGridView1_RowPostPaint(object sender, DataGridViewRowPostPaintEventArgs
原创 datatable的一些小技巧
//搜索行 var row = CodeData.Rows.OfType<DataRow>().Where(t => t.Field<string>("名稱") == code).ToList();if(row.Count == 0)/
原创 winform彈窗添加後傳值
主窗體: AddCodeForm ACForm = new AddCodeForm(); if (ACForm.ShowDialog() == DialogResult.OK) { string code = ""; A
原创 datagridview的一些小技巧
//滾輪定位到選中行 dataGridView1.Rows[i].Cells["Column1"].Selected = true; dataGridView1.FirstDisplayedScrollingRowIndex =
原创 c#打開對話框選擇後輸出文件路徑文件名
// 獲取文件夾絕對路徑 顯示在 txtbox 控件裏 System.Windows.Forms.FolderBrowserDialog folder = new System.Windows.Forms.FolderBrowse
原创 c#複製文件夾(複製主文件夾和不復制主文件夾)
複製主文件夾 private void CopyDirectory(string srcdir, string desdir) { try {
原创 c#查找相應目錄下文件
string[] files = Directory.GetFiles(path, filename, System.IO.SearchOption.AllDirectories);
原创 c#用rar壓縮文件
string startpath = "E:\\send\\one\\234"; string endpath = "E:\\savefile\\456.rar";
原创 xml的讀取
<?xml version="1.0" encoding="gb2312"?> <Update> <Url>123</Url> <File>UpdateXml1.xml</File> <MainEXE>TestMainUpd
原创 c#讀取excel
<span style="white-space:pre"> </span> System.Windows.Forms.OpenFileDialog fd = new OpenFileDialog(); if
原创 winform中DataGridView導出到Excel
<span style="white-space:pre"> </span>private void DataGridViewToExcel(DataGridView dgv) { SaveFil
原创 c#數據存入文件通用函數
private void writelog(String str) { FileStream logFile; try {