摘要:private void button1_Click(object sender, EventArgs e) { //定义一个为可取消资源标志 CancellationTokenSource cts = new CancellationTokenSource(); //定义二个为可取消资源标志...
阅读全文
摘要://调用的示例 private string fileName = "InStorageData.csv"; string filePath = parentPath + CommonHelper.UPLOAD + "\\" + fileName;/...
阅读全文
摘要:private void txt_Chinese_TextChanged(object sender, EventArgs e) { txt_PinYIn.Text = //调用拼音类的GetABC方法得到拼音字符串 new Pin...
阅读全文
摘要:private void btn_GetCount_Click(object sender, EventArgs e) { int P_scalar = 0;//定义值类型变量并赋值为0 Regex P_regex = //创建正则表达式对...
阅读全文
摘要:vb.net字符串格式转为日期型 比如 "20080815" 转换为"2008-05-15"Dim a As Date Dim s As String = "20080815" a = CDate(Format(CInt(s), "0000-00-00")) MsgBox(a.Year)
阅读全文
摘要:1 Dim Str As String = "" 2 Private Sub txtRecond_KeyUp(sender As System.Object, e As System.Windows.Forms.KeyEventArgs) Handles txtRecond.KeyUp 3 txtRecond.Text = Regex.Replace(txtRecond.Text, "[^0-9]", "") 4 If txtRecond.Text = "" Then 5 Return 6 End If ...
阅读全文
摘要:List conList= new List(); List listII = new List(); int m = 0; for (int i = 0; i < conList.Count; i++) { string i_value = (string)conList[i]; for (int j = 0; j < conList.Count; j++) { ...
阅读全文
摘要:注意需添加引用System.Management)public static string Distinguish64or32System(){try{string addressWidth = String.Empty;ConnectionOptions mConnOption = new ConnectionOptions();ManagementScope mMs = new ManagementScope("\\\\localhost", mConnOption);ObjectQuery mQuery = new ObjectQuery("select A
阅读全文
摘要:[System.Runtime.InteropServices.DllImport("User32.dll", CharSet = System.Runtime.InteropServices.CharSet.Auto)] private static extern int GetWindowThreadProcessId(IntPtr hwnd, out int ID); private void Kill(Microsoft.Office.Interop.Excel.Application excel) { IntPtr t ...
阅读全文
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace ECS.Simulate{ public partial class FrmProgress : Form { public FrmProgress() { InitializeComponent(); this.CenterToParent(); progres
阅读全文
摘要:C# 操作XmlDocument文档1.第一步选择文件目录string FileName=string.Empty;SaveFileDialog sfd=new SaveFileDialog();if(sfd.ShowDialog() == DialogResult.OK){ FileName = sfd.FileName; }FileStream fs;//判断文件是否存在if(!File.Exists(FileName)){ fs = File.Create(FileName); fs.Close();}2.创建文件的声明XmlDocument xmlDoc = new XmlDocume
阅读全文
摘要:具体是新安装的系统Windows XP SP2打完最新所有补丁IE6 WMP10安装Visual Studio 2008 Pro版本。打开新建的工程10秒左右界面没响应。无法切换设计模式或者键入代码调试时程序正常退出后也是10秒左右界面没有响应。使用console App Winform一样。webapp正常。或者直接kill vshost进程,可以立即进入界面。所谓响应是指在界面键入字符可以立即看到。目前解决方案。取消Visual Studio Visual host支持。具体在工程的属性debug里面最后一项。
阅读全文
摘要:开发环境: VS2008 DOSFRAMER版本为1.3 MS OFFICE2003+SP3 最近一直想用VC#2008做个内嵌WORD/OFFICE的WINFORM,目前主要有以下解决途径: 1、直接通过API把WORD/OFFICE的窗口句柄给放到WINFORM中(较为复杂); 2、通过WEB BROWSER; 3、利用DSOFRAMER。 本人都测试了一下,觉得DSOFRAMER更符合自己的愿望,故决定使用DSOFRAMER来实现。 操作步骤: 1、从微软网站下载DsoFramer_KB311765_x86.exe,解开将得到dsoframer.ocx; 2、把ds...
阅读全文
摘要:/// <summary> /// 获取目录中所有文件包含子目录中的文件 /// </summary> /// <param name="path"></param> /// <returns></returns> private List<string> GetAllFiles(string path) { List<string> list = GetFiles(path); foreach (string dir in Directory.Get...
阅读全文
摘要:System.Data.DataTable dt = new System.Data.DataTable(); DataColumn FileName; DataColumn FileDirectory; public FrmGetFileDirectory() { InitializeComponent(); } /// <summary> /// 获取文件目录及文件全称 /// </summary> /// <param nam...
阅读全文
摘要:/// <summary> /// 上传文件 /// </summary> /// <param name="fileinfo">需要上传的文件</param> /// <param name="targetDir">目标路径</param> /// <param name="hostname">ftp地址</param> /// <param name="username">ftp用户名</param
阅读全文
摘要:/// <summary> /// 返回指定目录下的所有文件信息 /// </summary> /// <param name="strDirectory"></param> /// <returns></returns> public List<FileInfo> GetAllFilesInDirectory(string strDirectory) { List<FileInfo> listFiles = new List<FileInfo>(); //保存所有的
阅读全文
摘要:1,在下拉列表框添加项2,在文本框显示下拉列表框的不同项3,显示datagridview的列表列标题为下拉列表框不同项的内容using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;namespace learncomboxanddatagridview{ public partial class Form1 : Form { ...
阅读全文
摘要:private void Form1_Load(object sender, EventArgs e) { DataTable table = new DataTable("Student"); DataColumn studentID = new DataColumn("studentID", typeof(string)); table.Columns.Add(studentID); DataColumn studentName = new DataColumn("stud...
阅读全文
摘要:xml文件的生成操作选择内容(Content) - 不编译该文件,但将其包含在“内容”(Content) 输出组中。编译(Compile) - 将该文件编译到生成输出中。此设置用于代码文件。 嵌入资源(Embedded Resource) - 将该文件作为 DLL 或可执行文件嵌入主项目生成输出中。内容的读写和运行目录下的其他文件没有区分。编译和嵌入资源读写,需要用到,例如:GetType().Assembly.GetManifestResourceStream(assembleName +".AppDesc.xml");
阅读全文