/// <summary> /// 二分查找算法 /// </summary> /// <param name="arr">要查找的数组</param> /// <param name="sel">要查找的值</param> /// <returns></returns> protected string GetValue(string[] arr, string sel) { int langth = arr.Length;//数组的长度 int m... Read More
posted @ 2011-06-23 12:35 javawebsoa Views(161) Comments(0) Diggs(0) Edit
using (TransactionScope scope = new TransactionScope()){ //创建事物对象 try { //执行事务操作的相关代码 scope.Complete(); //提交事物 } catch (Exception ex) { throw ex; } //抛出异常 finally { scope.Dispose(); } //回滚事物} Read More
posted @ 2011-06-23 12:33 javawebsoa Views(202) Comments(0) Diggs(0) Edit
static void Main(string[] args){ if (args.Length == 0 || String.IsNullOrEmpty(args[0])) { Console.WriteLine("No filename provided."); return; } string filepath = args[0]; if (Path.GetFileName(filepath) == args[0]) { filepath = Path.Combine(Environment.CurrentD... Read More
posted @ 2011-06-23 12:32 javawebsoa Views(281) Comments(0) Diggs(0) Edit
//第一种方法:Response.ClearContent();Response.ClearHeaders();Response.ContentType = "Application/msword";string s = Server.MapPath("C#语言参考.doc");Response.WriteFile("C#语言参考.doc");Response.Write(s);Response.Flush();Response.Close(); //第二种方法:Response.ClearContent();Response.Cle Read More
posted @ 2011-06-23 12:32 javawebsoa Views(189) Comments(0) Diggs(0) Edit
private void SetFormCircle() { int radian = 4; //圆弧角的比率,可以自己改变这个值看具体的效果int w = this.Width; //窗体宽int h = this.Height; //窗体高 //对于矩形的窗体,要在一个角上画个弧度至少需要2个点,所以4个角需要至少8个点Point p1 = new Point(radian, 0); Point p2 = new Point(w ? radian, 0); Point p3 = new Point(w, radian); Point p4 = n... Read More
posted @ 2011-06-23 12:31 javawebsoa Views(844) Comments(1) Diggs(0) Edit
using System;using System.Collections.Generic;using System.Text;using System.Xml; namespace NetProject.Property{ public class XmlDoc { /// <summary> /// 创建Xml文件 /// </summary> /// <param name="xmlPath">创建文件路径</param> /// <param name="element"></pa Read More
posted @ 2011-06-23 12:28 javawebsoa Views(173) Comments(0) Diggs(0) Edit
//参数:d表示要四舍五入的数;i表示要保留的小数点后为数。 /// <summary> /// 四舍五入 /// </summary> /// <param name="d">计算的数</param> /// <param name="i">要保留的小数点后为数</param> /// <returns>四舍五入结果</returns> public static double Round(double d, int i) { if (d >= 0) Read More
posted @ 2011-06-23 12:28 javawebsoa Views(206) Comments(0) Diggs(0) Edit
public void sort(int[] array) { int length = array.Length; for (int i = 0; i < length - 1; i++) { for (int j = length - 1; j > 1; j--) { if (array[j] < array[i - 1]) { int tmp = array[j]; array[... Read More
posted @ 2011-06-23 12:26 javawebsoa Views(234) Comments(0) Diggs(0) Edit
public void GetComList() { RegistryKey keyCom = Registry.LocalMachine.OpenSubKey("Hardware/DeviceMap/SerialComm"); if (keyCom != null) { string[] sSubKeys = keyCom.GetValueNames(); this.comboBox3.Items.Clear(); fore... Read More
posted @ 2011-06-23 12:25 javawebsoa Views(459) Comments(0) Diggs(0) Edit
public void GetComList(ComboBox cbx) { //初始化COM口到列表 RegistryKey keyCom = Registry.LocalMachine.OpenSubKey("Hardware/DeviceMap/SerialComm"); if (keyCom != null) { string[] sSubKeys = keyCom.GetValueNames(); cbx.Items.Clear(); ... Read More
posted @ 2011-06-23 12:25 javawebsoa Views(151) Comments(0) Diggs(0) Edit
/// <summary> /// 转全角的函数(SBC case) /// </summary> /// <param name="input">任意字符串</param> /// <returns>全角字符串</returns> ///<remarks> ///全角空格为12288,半角空格为32 ///其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248 ///</remarks> public static string ToSBC( Read More
posted @ 2011-06-23 12:24 javawebsoa Views(180) Comments(0) Diggs(0) Edit
Excel是微软公司办公自动化套件中的一个软件,他主要是用来处理电子表格。Excel以其功能强大,界面友好等受到了许多用户的欢迎。在设计应用系 统时,对于不同的用户,他们对于打印的需求是不一样的,如果要使得程序中的打印功能适用于每一个用户,可以想象程序设计是十分复杂的。由于Excel表格 的功能强大,又由于几乎每一台机器都安装了它,如果把程序处理的结果放到Excel表格中,这样每一个用户就可以根据自己的需要在Excel中定制自己的 打印。这样不仅使得程序设计简单,而且又满足了诸多用户的要求,更加实用了。那么用Visual C#如何调用Excel,如何又把数据存放到Excel表格中?本文就来探讨 Read More
posted @ 2011-06-23 12:23 javawebsoa Views(284) Comments(0) Diggs(0) Edit
//GridView合并单元格//中间变量,存取TableCell private TableCell publishDateCell = null; protected void grvTest_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { //第一行,publishDateCell=null if (publishDateCell == null) ... Read More
posted @ 2011-06-23 12:23 javawebsoa Views(189) Comments(0) Diggs(0) Edit
/// <summary> /// 获取截图 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnGo_Click(object sender, EventArgs e) { HttpWebRequest myReq = (HttpWebRequest)HttpWebRequest.Create(txtAddress.Text); HttpWeb Read More
posted @ 2011-06-23 12:22 javawebsoa Views(439) Comments(0) Diggs(0) Edit
/// <summary> /// TreeView展开事件创建子节点,折叠事件进入展开事件将:EnableClientScript设置为false /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void TreeViewSilkItems_TreeNodeExpanded(object sender, TreeNodeEventArgs e) { if Read More
posted @ 2011-06-23 12:21 javawebsoa Views(334) Comments(0) Diggs(0) Edit
using System;using System.Collections.Generic;using System.Text;using System.Net;using System.IO;using System.Globalization;using System.Text.RegularExpressions;namespace WebBaseLib{ /// <summary> /// FTP处理操作类 /// 功能: /// 下载文件 /// 上传文件 /// 上传文件的进度信息 /// 下载文件的进度信息 /// 删除文件 ... Read More
posted @ 2011-06-23 12:19 javawebsoa Views(237) Comments(0) Diggs(0) Edit