2008年9月3日

C# 判断字符串一是否包含字符串二

摘要: 方法一: Console.WriteLine("请输入第一个字符串:"); string str1 = Console.ReadLine(); Console.WriteLine("请输入第二个字符串:"); string str2 = Console.ReadLine(); i... 阅读全文

posted @ 2008-09-03 00:39 VictorShan 阅读(8269) 评论(0) 推荐(0)

C#中的对齐方式

摘要: Console.WriteLine("在宽度为10的空间里靠左对齐:{0,-10}", 99); //显示为:在宽度为10的空间里靠左对齐:99 Console.WriteLine("在宽度为10的空间里靠右对齐:{0,10}", 99); //显示为:在宽度为10的空间里靠右对齐: 99 Console.WriteLine("在宽度为10的空间里靠左对齐:{0,-10}",... 阅读全文

posted @ 2008-09-03 00:17 VictorShan 阅读(3236) 评论(0) 推荐(1)

2008年9月2日

用TextBox绑定网格

摘要: //矩形帮定cb与网格方法 public void f1(object sender, EventArgs e) { this.comboBox1.Text = dataGridView1.CurrentCell.Value.ToString(); Rectangle R = dataGridView1.GetCell... 阅读全文

posted @ 2008-09-02 00:26 VictorShan 阅读(418) 评论(0) 推荐(0)

winform文本框即输即选

摘要: private void textBox2_TextChanged( object sender, EventArgs e ) { // 文本框即输即选方法一 //this.textBox2.SelectionStart = 0; 可省 this.textBox2.SelectAll(); }... 阅读全文

posted @ 2008-09-02 00:24 VictorShan 阅读(489) 评论(0) 推荐(0)

C#的四个基本技巧 (转载 出处:51cto.com整理)

摘要: 1.如果可能尽量使用接口来编程 .NET框架包括类和接口,在编写程序的时候,你可能知道正在用.NET的哪个类。然而,在这种情况下如果你用.NET支持的接口而不是它的类来编程时,代码会变得更加稳定、可用性会更高。请分析下面的代码: private void LoadList (object [] items, ListBox l) { for (int i = 0; i < items.L... 阅读全文

posted @ 2008-09-02 00:05 VictorShan 阅读(231) 评论(0) 推荐(0)

2008年9月1日

C#读文件代码

摘要: using System; using System.IO; public class TestReadFile { public static void Main(String[] args) { // 创建文件流,读取文件的路径 FileStream fs = new FileStream(@c:\temp\test.txt , Fi... 阅读全文

posted @ 2008-09-01 23:51 VictorShan 阅读(511) 评论(0) 推荐(0)

C#写文件代码

摘要: using System; using System.IO; public class TestWriteFile { public static void Main(String[] args) { // Create a text file C:\temp\test.txt FileStream fs = new FileStrea... 阅读全文

posted @ 2008-09-01 23:48 VictorShan 阅读(1537) 评论(0) 推荐(0)

c# MD5加密算法的实例

摘要: 环境:vs.net2005/sql server2000/xp测试通过 1.MD5 16位加密实例 using System; using System.Collections.Generic; using System.Text; using System.Security.Cryptography; namespace md5 { class Program ... 阅读全文

posted @ 2008-09-01 23:13 VictorShan 阅读(262) 评论(0) 推荐(0)

导航