
正文
vb.net手机号验证 vb账号密码登录框验证
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
vb编程:编写验证用户是否输入以136开头的手机号码的正确性,并在页面给出验证结果
Private Sub Command1_Click()
Dim x As String
x = InputBox("请输入一个数", , 13622012345#)
If IsNumeric(x) And Len(x) = 11 And Left(x, 3) = 136 Then
MsgBox "136手机号正确:" x
Else
MsgBox "号码错误"
End If
End Sub
相关问答
Q1: .net 怎么实现手机短信验证
直接就可以用vb.net手机号验证,短信内容自己构造:(这家是上海第翼信息)vb.net手机号验证,不是打广告,上次做appvb.net手机号验证的接口就是用的这家的。给你搬过来。总的来说,也就是一个post请求
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Net;
using System.Text;
using System.IO;
namespace WebApplication1
{
public class SendSms
{
///
/// 以 HTTP 的 POST 提交方式 发送短信(ASP.NET的网页或是C#的窗体,均可使用该方法)
///
/// 要发送的手机号码
/// 要发送的内容
/// 发送结果
public string SendMsg(string mobile, string msg)
{
string name = "登陆账号";
string pwd = "接口密码(28位的)";//登陆web平台 在管理中心--基本资料--接口密码(28位) 如登陆密码修改,接口密码
会发生改变,请及时修改程序
string sign = "签名"; //一般为企业简称
StringBuilder arge = new StringBuilder();
arge.AppendFormat("name={0}", name);
arge.AppendFormat("pwd={0}", pwd);
arge.AppendFormat("content={0}", msg);
arge.AppendFormat("mobile={0}", mobile);
arge.AppendFormat("sign={0}", sign);
arge.Append("type=pt");
string weburl = "";
string resp = PushToWeb(weburl, arge.ToString(), Encoding.UTF8);
if (resp.Split(',')[0] == "0")
{
//提交成功
}
else
{
//提交失败,可能余额不足,或者敏感词汇等等
}
return resp;//是一串 以逗号隔开的字符串。阅读文档查看响应的意思
}
///
/// HTTP POST方式
///
/// POST到的网址
/// POST的参数及参数值
/// 编码方式
///
public string PushToWeb(string weburl, string data, Encoding encode)
{
byte[] byteArray = encode.GetBytes(data);
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(new Uri(weburl));
webRequest.Method = "POST";
webRequest.ContentType = "application/x-www-form-urlencoded";
webRequest.ContentLength = byteArray.Length;
Stream newStream = webRequest.GetRequestStream();
newStream.Write(byteArray, 0, byteArray.Length);
newStream.Close();
//接收返回信息:
HttpWebResponse response = (HttpWebResponse)webRequest.GetResponse();
StreamReader aspx = new StreamReader(response.GetResponseStream(), encode);
return aspx.ReadToEnd();
}
}
Q2: .net手机号验证正则表达式实例
var reg = new RegExp(/^((13[4-9])|(15[012789])|147|182|187|188)[0-9]{8}$/),
obj = document.getElementById("id"); //获取你的文本框值
if (reg.test(obj.value)) {
进来就是正确的手机号
}else{
//错误
}
Q3: VB NET 中怎样实现动态验证码
需要写个验证码类:
例如
public class ValidCode
public shared function Create() as integer
return Rand(0,100)
end Function
end class
需要在页面里面去调用类的共享方法,然后显示验证码(你也可以生成图片~~)
关于vb.net手机号验证和vb账号密码登录框验证的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。







