上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 107 下一页
摘要: 最近经常看到论坛中许多帖子询问如何使用split来分割字符串,我这里对split做一些简单的总结,希望能够对大家有所帮助。下面介绍几种方法: 第一种方法:打开vs.net新建一个控制台项目。然后在Main()方法下输入下面的程序。 string s="abcdeabcdeabcde"; string[] sArray=s.Split('c'); foreach(string i in sArray) Console.WriteLine(i.ToString()); 输出下面的结果:ab deab deab de 我们看到了结果是以一个指定的字符进行的分割。如果我们希望使用多个字符进行分割如c, 阅读全文
posted @ 2007-03-24 14:35 leonardleonard 阅读(154) 评论(0) 推荐(0) 编辑
摘要: 使用C#编写不同的“Hello World”程序 1. A Beginners Hello World public class HelloWorld { public static void Main() { System.Console.WriteLine("HELLO WORLD"); } } 2. Slightly improved version using System; public class HelloWorld { public static void Main() { Console.WriteLine("HELLO WORLD"); } } 3. Command Lin 阅读全文
posted @ 2007-03-24 14:34 leonardleonard 阅读(161) 评论(0) 推荐(0) 编辑
摘要: using System; using System.IO; using System.Runtime.InteropServices; using System.Text; using Microsoft.Win32; namespace Wjb.ReadOrWriteIniAndReg { /// summary /// HardDiskVal 的摘要说明。 /// 读取指定盘符的硬盘序列号 /// 功能:读取指定盘符的硬盘序列号 /// /summary public class HardDiskVal { [DllImport("kernel32.dll")] private 阅读全文
posted @ 2007-03-24 14:33 leonardleonard 阅读(683) 评论(0) 推荐(0) 编辑
摘要: 时候我们需要在内存中转换Image格式到Icon 根据经验,通常我们应该可以这样做 Image image = xxxx;///假设这里已经有一个Image对象 System.IO.MemoryStream mStream = new System.IO.MemoryStream();///创建内存流 image.Save(mStream, System.Drawing.Imaging.ImageFormat.Icon); Icon icon = Icon.FromHandle(new Bitmap(mStream).GetHicon()); mStream.Close(); 但这里在imag 阅读全文
posted @ 2007-03-24 14:31 leonardleonard 阅读(143) 评论(0) 推荐(0) 编辑
摘要: 在.Net中实现Web服务时,在Web服务接口中产生的任何用户异常(非SoapException之外的异常)都被包装为SoapException传递给客户端,这使得难以采用通常的方式处理Web Service的异常。本文讲述如何通过SoapExceptionHelper实现一致的异常处理。 Web Service的异常处理问题 在.Net中实现Web服务时,Web服务接口中产生的任何用户异常(非SoapException之外的异常)都被包装为SoapException传递给客户端 ,用户错误信息放置在SoapException的Message属性中。 下面的例子演示了一个SoapExcepti 阅读全文
posted @ 2007-03-24 14:29 leonardleonard 阅读(198) 评论(0) 推荐(0) 编辑
摘要: [C#] public static Process RunningInstance() { Process current = Process.GetCurrentProcess(); Process[] processes = Process.GetProcessesByName (current.ProcessName); //Loop through the running processes in with the same name foreach (Process process in processes) { //Ignore the current process if (p 阅读全文
posted @ 2007-03-24 14:28 leonardleonard 阅读(189) 评论(0) 推荐(0) 编辑
摘要: 做了一个控件,这样就可以告别图片按钮了:) 效果: 程序源代码: using System; using System.Collections; using System.ComponentModel; using System.Drawing; using System.Data; using System.Windows.Forms; using System.Drawing.Drawing2D; using System.Drawing.Text; namespace WindowsControlLibrary1 { /// summary /// UserControl1 的摘要说 阅读全文
posted @ 2007-03-24 14:27 leonardleonard 阅读(298) 评论(0) 推荐(0) 编辑
摘要: 文章“MSMQ:可伸缩、高可用性的负载平衡解决方案(英文)”介绍了一种解决方案,用于高可用性消息队列 (MSMQ) 的可伸缩负载平衡解决方案体系结构。此解决方案中涉及了一种将 Windows 服务用作智能消息路由器的开发方案。这样的解决方案以前只有 Microsoft Visual C++® 程序员才能实现,而 .NET 框架的出现改变了这种情况。从下面的解决方案中,您可以看到这一点。 .NET 框架应用程序 这里介绍的解决方案是一种用来处理若干消息队列的 Windows 服务;其中每个队列都是由多个线程进行处理(接收和处理消息)。处理程序使用循环法技术或应用程序特定值(消息 AppS 阅读全文
posted @ 2007-03-24 14:25 leonardleonard 阅读(450) 评论(1) 推荐(0) 编辑
摘要: 以下的源码里分别给出了将DBF,XLS,XML,MDB文件导入C#DataGrid的方法,供各位参考。 //PutInDataSet.cs的源码 using System; using System.Data.Odbc; using System.Data.OleDb; using System.Data; using System.Collections; namespace PutInDataSet { /// summary /// DataSetTransIn 的摘要说明。 /// /summary public class PutInDataSet { /// summar 阅读全文
posted @ 2007-03-24 14:22 leonardleonard 阅读(207) 评论(0) 推荐(0) 编辑
摘要: 本文利用C#和.NET提供的类来轻松创建一个抓取网页内容源代码的程序。HTTP是WWW进行数据访问最基本的协议之一,在.NET的基本类型库类中提供了两个对象类:HTTPWebRequest和HTTPWebResponse,分别用来向某资源发送请求和获得响应。为了得到一个资源的内容,我们先指定一个想要抓取的URL地址,用HTTPWebRequest对象进行请求,用HTTPWebResponse对象接收响应的结果,最后用TextStream对象来提取我们想要的信息,并在控制台打印出来。 下面就是看看如何实现这样的功能: 第一步:打开VS.NET,点“文件”-“新建”-“项目”,项目类型选择“Vis 阅读全文
posted @ 2007-03-24 14:21 leonardleonard 阅读(160) 评论(0) 推荐(0) 编辑
上一页 1 ··· 18 19 20 21 22 23 24 25 26 ··· 107 下一页