随笔分类 -  C#

摘要:使用itextsharp生成PDF文件,设置PdfPTable与表题间距离 阅读全文
posted @ 2014-10-20 14:06 慧由心生 阅读(10410) 评论(1) 推荐(0)
摘要:#region 小写金额转换为大写 public static string CurrToChnNum(double Currnum) { string sResult = ""; if (Math.Abs(Cu... 阅读全文
posted @ 2014-09-19 15:38 慧由心生 阅读(1380) 评论(0) 推荐(0)
摘要:代码支持任意office格式需要安装office 2007 还有一个office2007的插件OfficeSaveAsPDFandXPS下载地址[url]http://www.microsoft.com/downloads/details.aspx?FamilyId=4D951911-3E7E-4... 阅读全文
posted @ 2014-09-02 10:42 慧由心生 阅读(8799) 评论(0) 推荐(1)
摘要:问题: VS生成程序时,报“要将程序集“XX.dll”标记为系统必备组件,必须对其进行强签名。”错误。解决方法: 1)在报错的解决方案中找到一个可以发布的项目(引用该XX.dll的项目未必可以发布); 2)右击该项目,选择“属性”; 3)选择“发布”; 4)点击“应用程序文件”按钮; 5)找到该“X... 阅读全文
posted @ 2014-08-26 09:39 慧由心生 阅读(14402) 评论(1) 推荐(1)
摘要:1、判断指定路径下文件是否存在: /// /// 判断服务器上指定文件夹下指定文件是否存在。 /// /// 是否存在 [WebMethod(Description = "判断指定路径下的指定文件是否存在。")] pu... 阅读全文
posted @ 2014-08-19 16:47 慧由心生 阅读(427) 评论(0) 推荐(0)
摘要:1、计算文本哈希值:public static string ComputeHash(string password) { byte[] buffer = System.Text.Encoding.UTF8.GetBytes(password); SHA1Crypt... 阅读全文
posted @ 2014-08-19 16:43 慧由心生 阅读(9876) 评论(0) 推荐(0)
摘要:string date = DateTime.Now.ToString("yyyy-MM-dd"); string rootPath = System.Environment.CurrentDirectory; ... 阅读全文
posted @ 2014-08-15 15:38 慧由心生 阅读(317) 评论(0) 推荐(0)
摘要:0、获取网络IP、端口: NameValueCollection nameValueTable = new NameValueCollection(); if (ApplicationDeployment.IsNetworkDeployed) ... 阅读全文
posted @ 2014-08-14 13:21 慧由心生 阅读(411) 评论(0) 推荐(0)
摘要:1、获取当前部署: public static NameValueCollection GetQueryStringParameters() { NameValueCollection nameValueTable = new NameValueCo... 阅读全文
posted @ 2014-08-12 15:42 慧由心生 阅读(474) 评论(0) 推荐(0)
摘要:1、将DataTable转换成xml字符串 //将DataTable转换成xml字符串: public string ConvertDataTableToXml(DataTable dt) { MemoryStream stream = n... 阅读全文
posted @ 2014-08-12 13:14 慧由心生 阅读(234) 评论(0) 推荐(0)
摘要:1.将主程序界面上的Icon赋给基类内的Icon(同时其他子类也具有了此Icon): public partial class BaseForm : Form { public BaseForm() { InitializeCompone... 阅读全文
posted @ 2014-08-07 15:00 慧由心生 阅读(348) 评论(0) 推荐(0)
摘要:[DllImport("user32.dll", EntryPoint = "GetScrollInfo", CallingConvention = CallingConvention.StdCall)] public static extern bool GetScr... 阅读全文
posted @ 2014-06-11 17:36 慧由心生 阅读(4327) 评论(0) 推荐(0)
摘要:string strConn; strConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + filePath + ";Extended Properties='Excel 8.0;HDR=F... 阅读全文
posted @ 2014-06-10 15:00 慧由心生 阅读(401) 评论(0) 推荐(0)
摘要:1、检查数据库连接的有效性 var client = new System.Net.Sockets.TcpClient(); var ar = client.BeginConnect(host, 1433, null, null); ar.AsyncWaitHandle.WaitOn... 阅读全文
posted @ 2014-06-10 14:54 慧由心生 阅读(9005) 评论(1) 推荐(0)
摘要:using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ConsoleApplication1 { /// /// 公用的特殊函数 /// public class SpecialFunctions { ... 阅读全文
posted @ 2014-06-06 17:13 慧由心生 阅读(17412) 评论(0) 推荐(4)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApplication2{ class... 阅读全文
posted @ 2014-05-28 14:49 慧由心生 阅读(340) 评论(0) 推荐(0)
摘要:【【【【C#压缩文件】】】】方法1: //【filepath想要压缩文件的地址】 //【zippath输出压缩文件的地址】 private void GetFileToZip(string filepath,string zippath) { FileStrea... 阅读全文
posted @ 2014-05-13 15:27 慧由心生 阅读(313) 评论(0) 推荐(1)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;namespace Common{ /// /// TextBox控... 阅读全文
posted @ 2014-05-07 14:01 慧由心生 阅读(3797) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;namespace Common{ /// /// 列表视图操作类 ... 阅读全文
posted @ 2014-05-07 13:59 慧由心生 阅读(2330) 评论(0) 推荐(0)
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Windows.Forms;namespace Common{ /// /// DataGrid... 阅读全文
posted @ 2014-05-07 13:54 慧由心生 阅读(636) 评论(0) 推荐(0)