10 2011 档案
丶正则表达式验证手机号码
摘要:我想问个问题啊 为什么 代码贴过来以后 没有自动缩进了呢 我郁闷的 前面的都还好好的。现在怎么没了呢 !这段代码的 关键 还是在于对正则表达式的理解!@"^[1][3-5,8]\d{9}$" 详解@去除后面的转义字符的效果^表示匹配行开始$表示匹配行结束[1]表示第一为数为1 只为1[3-5,8] 表示第二位数字可以 为 3,4,5,8四个中的其中任何一个\d表示匹配数字 注:\还表示转义字符 前面 的@就是为了消除它的效果{9}表示限制符 意即[1][3-5,8]后面可以输入9位数字using System;using System.Collections.Generic 阅读全文
posted @ 2011-10-27 22:57 C#_初学者 阅读(300) 评论(0) 推荐(0)
丶如何确定系统的运行时间
摘要:效果图:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threading;namespace Example66{ public partial class Form1 : Form { public Form1() { InitializeComponent( 阅读全文
posted @ 2011-10-26 23:12 C#_初学者 阅读(294) 评论(0) 推荐(0)
丶根据出生日期计算年龄
摘要:效果图:说明:本实例中使用了VB程序集中DateTime类的DateDiff方法来计算日期的差! 需要引用该类 资源管理器中 右键添加引用 .net页Microsoft.VisualBasic 确定即可 然后在工程文件里 引用 它 using Microsoft.VisualBasic;代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text... 阅读全文
posted @ 2011-10-26 21:09 C#_初学者 阅读(1441) 评论(0) 推荐(0)
丶设置系统日期时间
摘要:效果图:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Runtime.InteropServices;namespace Example54{ public partial class Form1 : Form { public Form1() ... 阅读全文
posted @ 2011-10-23 19:38 C#_初学者 阅读(452) 评论(0) 推荐(0)
丶动态获取系统当前时间
摘要:效果图:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example53{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } ... 阅读全文
posted @ 2011-10-23 18:49 C#_初学者 阅读(417) 评论(0) 推荐(0)
丶格式化输入数据为货币格式
摘要:效果图:代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Globalization;namespace Example51{ public partial class Form1 : Form { public Form1() { Ini... 阅读全文
posted @ 2011-10-23 17:33 C#_初学者 阅读(348) 评论(0) 推荐(0)
丶对计算结果进行四舍五入
摘要:效果图:原理:在所有要丢失精度的小数位中加5,大于10进位代码:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example48{ public partial class Form1 : Form { public Form1() { Initi... 阅读全文
posted @ 2011-10-23 13:37 C#_初学者 阅读(277) 评论(0) 推荐(0)
丶判断输入的货币值是否为数字
摘要:TryParse方法首先会尝试将字符串转换为指定数值类型,如果转换成功 则 返回 True 并对参数中变量赋值。 否则 返回False 语法如下:double.TryParse(string str, out double result);using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;name 阅读全文
posted @ 2011-10-23 13:15 C#_初学者 阅读(247) 评论(0) 推荐(0)
丶对字符串进行加密和解密
摘要:效果图:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example46{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } pr... 阅读全文
posted @ 2011-10-23 12:33 C#_初学者 阅读(282) 评论(0) 推荐(0)
丶获取字符串中汉字的个数
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Text.RegularExpressions;namespace Example44{ public partial class Form1 : Form { public Form1() { ... 阅读全文
posted @ 2011-10-21 00:21 C#_初学者 阅读(337) 评论(0) 推荐(0)
丶从字符串中分离文件路径、文件名和扩展名
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example43{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-20 01:18 C#_初学者 阅读(1892) 评论(0) 推荐(0)
丶去除字符串中的所有空格
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Collections; // 引用 IEnumeratornamespace Example42{ public partial class Form1 : Form { public Form1() {... 阅读全文
posted @ 2011-10-20 00:24 C#_初学者 阅读(284) 评论(0) 推荐(0)
丶将字符串的每个字符进行颠倒输出
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example41{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-19 22:51 C#_初学者 阅读(562) 评论(0) 推荐(0)
丶根据标点符号对字符串进行分行
摘要:// 效果图 --------using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example39{ public partial class Form1 : Form { public Form1() { InitializeComponent();... 阅读全文
posted @ 2011-10-18 23:43 C#_初学者 阅读(1286) 评论(0) 推荐(0)
丶汉字与区位码的转换
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example37{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-18 21:50 C#_初学者 阅读(508) 评论(0) 推荐(0)
丶字母与ASCII码的转换
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example36{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-18 21:25 C#_初学者 阅读(706) 评论(0) 推荐(0)
丶将字母全部转换为大写或小写
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example35{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-18 20:32 C#_初学者 阅读(816) 评论(0) 推荐(0)
丶使用goto语句在数组中搜索指定图书
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example34{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } string... 阅读全文
posted @ 2011-10-18 01:29 C#_初学者 阅读(381) 评论(0) 推荐(0)
丶制作一个数字猜猜看小游戏
摘要:效果图 ----using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Threading; //用到了线程namespace Example33{ public partial class Form1 : Form { public Form1() { ... 阅读全文
posted @ 2011-10-17 23:31 C#_初学者 阅读(2203) 评论(0) 推荐(0)
丶递归算法的经典面试题
摘要:1,1,2,3,5,8,13,21,34....... 要求用递归的方法算出 第 30 个数是多少!using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example32{ public partial class Form1 : Form { public Form1... 阅读全文
posted @ 2011-10-17 21:48 C#_初学者 阅读(1229) 评论(0) 推荐(0)
丶循环向控制台中输入 内容
摘要:using System;using System.Collections.Generic;using System.Linq;using System.Text;namespace Example31{ class Program { static void Main(string[] args) { Console.Title = "循环向控制台中输入内容"; //定义控制台标题 Console.WindowWidth = 30; //窗体宽度 Console.WindowHeight = 2; //窗体高度 ... 阅读全文
posted @ 2011-10-17 01:34 C#_初学者 阅读(865) 评论(0) 推荐(0)
丶使用as关键字将对象转换为指定类型
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.IO;namespace Example26{ public partial class Form1 : Form { public Form1() { InitializeComponent()... 阅读全文
posted @ 2011-10-17 01:33 C#_初学者 阅读(268) 评论(0) 推荐(0)
丶使用is关键字判断对象是否与指定类型兼容
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example24{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-17 01:32 C#_初学者 阅读(280) 评论(0) 推荐(0)
丶使用 typeof 关键字获取类的内部结构
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;using System.Reflection; // MethodInfo 需要引用namespace Example23{ public partial class Form1 : Form { public Form1() {... 阅读全文
posted @ 2011-10-17 01:27 C#_初学者 阅读(219) 评论(0) 推荐(0)
丶使用 checked 关键字处理 溢出 错误信息
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example22{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-17 01:25 C#_初学者 阅读(307) 评论(0) 推荐(0)
丶使用条件运算符判断指定年份是不是闰年
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example20{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } privat... 阅读全文
posted @ 2011-10-17 01:22 C#_初学者 阅读(768) 评论(1) 推荐(0)
丶巧用位移运算符获取汉字编码值
摘要:using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace Example019{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } priva... 阅读全文
posted @ 2011-10-17 01:06 C#_初学者 阅读(647) 评论(0) 推荐(0)