摘要:首先添加一个新项,这里添加的网页文件名是Default.aspx在Default.aspx里放入两个TextBox,设ID分别为TextBox1和TextBox2.设TextBox2的TextMode属性为Password放入一个Button控件,设ID为Button1,Text属性为"Login"在Ddfault.aspx网页中加入下面代码<script language="javascr...
阅读全文
摘要:只能输入n位的数字:"^\d{n}$"。 只能输入至少n位的数字:"^\d{n,}$"。 只能输入m~n位的数字:。"^\d{m,n}$" 只能输入零和非零开头的数字:"^(0|[1-9][0-9]*)$"。 只能输入有两位小数的正实数:"^[0-9]+(.[0-9]{2})?$"。 只能输入有1~3位小数的正实数:"^[0-9]+(.[0-9]{1,3})?$"。 只能输入非零的正整...
阅读全文
摘要://索引器类 class MyArrayList { object[] MyOBJ; //1.定义object类型的数组 int i = 0; public MyArrayList(int i) //2.规定数组长度 { MyOBJ = new o...
阅读全文
摘要://以连库为例 SqlConnection con; try { con = new SqlConnection(); con.Open(); return con; } catch(Exception e) ...
阅读全文
摘要:方法一: Console.WriteLine("请输入第一个字符串:"); string str1 = Console.ReadLine(); Console.WriteLine("请输入第二个字符串:"); string str2 = Console.ReadLine(); i...
阅读全文
摘要:Console.WriteLine("在宽度为10的空间里靠左对齐:{0,-10}", 99); //显示为:在宽度为10的空间里靠左对齐:99 Console.WriteLine("在宽度为10的空间里靠右对齐:{0,10}", 99); //显示为:在宽度为10的空间里靠右对齐: 99 Console.WriteLine("在宽度为10的空间里靠左对齐:{0,-10}",...
阅读全文
摘要:1.如果可能尽量使用接口来编程 .NET框架包括类和接口,在编写程序的时候,你可能知道正在用.NET的哪个类。然而,在这种情况下如果你用.NET支持的接口而不是它的类来编程时,代码会变得更加稳定、可用性会更高。请分析下面的代码: private void LoadList (object [] items, ListBox l) { for (int i = 0; i < items.L...
阅读全文
摘要:using System; using System.IO; public class TestReadFile { public static void Main(String[] args) { // 创建文件流,读取文件的路径 FileStream fs = new FileStream(@c:\temp\test.txt , Fi...
阅读全文
摘要: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...
阅读全文