c#中如何控制输入的文本为数字,长度为12位,以20081230开头,谢谢

[复制链接]
查看11 | 回复4 | 2012-3-8 13:58:34 | 显示全部楼层 |阅读模式
文本框只可输入数字且长度为最长为12位:以什么开头可以用JS判断...
回复

使用道具 举报

千问 | 2012-3-8 13:58:34 | 显示全部楼层
using System;using System.Collections.Generic;using System.Text;using System.Text.RegularExpressions; namespace ConsoleApplication3{
class Program
{
...
回复

使用道具 举报

千问 | 2012-3-8 13:58:34 | 显示全部楼层
int i = textbox1.text.length;if(i !=12){...}else{if(textbox1.text.Substring(0,8)=='20081230'){}else{.......}}...
回复

使用道具 举报

千问 | 2012-3-8 13:58:34 | 显示全部楼层
1,为数字try{int text1=Convert.ToInt32(this.TextBox1.Text.Trim()); return true;}catch(Exception ee){return false;}2,长度12.Length=12;3,以20081230开头SubString(this.TextBox1.text...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行