vb.net注册表密码,vbs注册表

vb.net 注册问题

改为:

成都创新互联公司长期为千余家客户提供的网站建设服务,团队从业经验10年,关注不同地域、不同群体,并针对不同对象提供差异化的产品和服务;打造开放共赢平台,与合作伙伴共同营造健康的互联网生态环境。为仙桃企业提供专业的成都网站建设、网站设计仙桃网站改版等技术服务。拥有10余年丰富建站经验和众多成功案例,为您定制开发。

sql = "insert into 表1 values(用户名='" TextBox1.Text "' ,密码='" TextBox2.Text "')"

我用VB.net做了个注册表连接到SQL的数据库,可是有问题说conn.open()打不开,谁能帮我解决一下,急急急 …

你这明显是与数据库连接出的错!

1.确认数据库名是否是buy?

2.将连接字符串中的Data Source改为127.0.0.1或者local。

3.去掉 Integrated Security = true 这句,加入user=用户名; pwd=密码; 。

请问用VB.NET中 如何将注册窗口的用户名和密码传递给登录窗口的用户名和密码?拜托了

建立一个模块,在其中定义全局变量

Public a as string

public b as string

然后在注册,登陆界面分别引用就好了

VB.net 如何实现记住密码 自动登录

代码如下:

/// summary

/// 连接到窗体:通过密码保护信息找回密码!

/// /summary

/// param name="sender"/param

/// param name="e"/param

private void lbl_mibao_Click(object sender, EventArgs e)

{

Getbackpwd getbackpwd = new Getbackpwd();

getbackpwd.Show();

}

/// summary

/// 当该窗体加载时从xml文件中读取用户信息并加载到combox的Items中

/// /summary

/// param name="sender"/param

/// param name="e"/param

private void Addresslist_Load(object sender, EventArgs e)

{

XmlTextReader reader = new XmlTextReader(@"E:\面向对象--C#练习\通讯录\address list\address list\user.xml");

while (reader.Read())

{

//if (reader.LocalName.Equals("Name") || reader.LocalName.Equals("Number"))

if (reader.LocalName.Equals("username"))

{

this.cmbUserName.Items.Add(reader.ReadString());

}

//if (reader.LocalName.Equals("Number"))

//{

// this.label2.Text += reader.ReadString() + "\n";\

//}

}

reader.Close();

}

/// summary

/// 保存用户名到user.xml

/// /summary

//在listcontol上更改SelectedValue时执行从数据库读取密码的事件

private void cmbUserName_SelectedValueChanged(object sender, EventArgs e)

{

string username = cmbUserName.Text.Trim();

string sql = string.Format("select pwd from Admin where Username='{0}'", username);

try

{

SqlCommand command = new SqlCommand(sql, DBHelper.connection);

DBHelper.connection.Open();

SqlDataReader dataReader = command.ExecuteReader();

while (dataReader.Read())

{

txtpwd.Text = (string)dataReader["pwd"];

checkBoxpwd.Checked = true;

}

}

catch

{

MessageBox.Show("数据库操作出错!");

}

finally

{

DBHelper.connection.Close();

}

}

/// summary

/// 记住密码操作

/// /summary

/// param name="sender"/param

/// param name="e"/param

private void checkBoxpwd_Enter(object sender, EventArgs e)

{

bool check = true;

check = checkinput(cmbUserName.Text.Trim());

if ((string)cmbUserName.Text.Trim() == "")

{

MessageBox.Show("请输入用户名", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

cmbUserName.Focus();

}

else

{

if (txtpwd.Text.Trim() == "")

{

MessageBox.Show("请输入密码", "输入提示", MessageBoxButtons.OK, MessageBoxIcon.Information);

txtpwd.Focus();

}

else

{

bool isValidUser = false; // 标识是否为合法用户

string message = ""; // 如果登录失败,显示的消息提示

// 如果验证通过,就显示相应的用户窗体,并将当前窗体设为不可见

if (ValidateInput())

{

// 调用用户验证方法

isValidUser = ValidateUser(cmbUserName.Text, txtpwd.Text, ref message);

// 如果是合法用户,显示相应的窗体

if (isValidUser)

{

if (check == true)

{

XmlDocument doc = new XmlDocument();

doc.Load(@"E:\面向对象--C#练习\通讯录\address list\address list\user.xml");//(@"E:\面向对象--C#练习\通讯录\address list\address list\user.xml");

XmlElement node = doc.CreateElement("user");

XmlNode xnode = (XmlNode)doc.CreateElement("username");

xnode.InnerText = cmbUserName.Text.Trim();

node.AppendChild(xnode);

doc.DocumentElement.InsertAfter(node, doc.DocumentElement.LastChild);

doc.Save(@"E:\面向对象--C#练习\通讯录\address list\address list\user.xml");

//doc.Load (@"E:\面向对象--C#练习\通讯录\address list\address list\user.xml");

}

}

// 如果登录失败,显示相应的消息

else

{

MessageBox.Show(message, "记住密码失败!", MessageBoxButtons.OK, MessageBoxIcon.Information);

}

}

}

}

}

/// summary

/// 验证当前combox中内容是否已经存在于xml文件中

/// /summary

/// param name="text"/param

/// returns/returns

private bool checkinput(string text)

{

int count;

bool c = true;

for (count = 0; count cmbUserName.Items.Count;count ++ )

{

if (text ==(string )cmbUserName .Items [count])

{

c=false;

}

}

return c;

}

xml文件内容如下:?xml version="1.0" encoding="utf-8"?

person

user

VB.net2010 操作注册表

的完整路径写在HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

就可以自启动了。

以下是我前一段时间写的防u盘自动运行的程序,里面可以找到如何操作注册表。

Option Explicit

Global Const REG_SZ As Long = 1

Global Const REG_DWORD As Long = 4

Global Const HKEY_CLASSES_ROOT = H80000000

Global Const HKEY_CURRENT_USER = H80000001

Global Const HKEY_LOCAL_MACHINE = H80000002

Global Const HKEY_USERS = H80000003

Global Const ERROR_NONE = 0

Global Const ERROR_BADDB = 1

Global Const ERROR_BADKEY = 2

Global Const ERROR_CANTOPEN = 3

Global Const ERROR_CANTREAD = 4

Global Const ERROR_CANTWRITE = 5

Global Const ERROR_OUTOFMEMORY = 6

Global Const ERROR_INVALID_PARAMETER = 7

Global Const ERROR_ACCESS_DENIED = 8

Global Const ERROR_INVALID_PARAMETERS = 87

Global Const ERROR_NO_MORE_ITEMS = 259

Global Const KEY_ALL_ACCESS = H3F

Global Const REG_OPTION_NON_VOLATILE = 0

Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey As Long) As Long

Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hkey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long

Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, lpData As Long, lpcbData As Long) As Long

Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, lpValue As Long, ByVal cbData As Long) As Long

Private Sub cmdAbout_Click()

MsgBox "作者wolfccb不对本软件可能造成的任何错误或损失负责,请自行承担使用风险。", vbInformation, "About"

End Sub

Private Sub cmdDefault_Click()

Check0.Value = 1

Check1.Value = 0

Check2.Value = 1

Check3.Value = 0

Check4.Value = 1

Check5.Value = 0

Check6.Value = 0

End Sub

Private Sub cmdExit_Click()

Unload Me

End Sub

Private Sub cmdRecommend_Click()

Check0.Value = 1

Check1.Value = 1

Check2.Value = 1

Check3.Value = 1

Check4.Value = 1

Check5.Value = 0

Check6.Value = 1

End Sub

Private Sub cmdSet_Click()

Dim hkey As Long

Dim lvalue As Long

Dim cddata As Long

Dim retval As Long

lvalue = GetValue

retval = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hkey)

retval = RegSetValueEx(hkey, "NoDriveTypeAutoRun", 0, REG_DWORD, lvalue, 4)

RegCloseKey hkey

If retval = 0 Then

MsgBox "设置已保存。", vbInformation, "提示"

Else

MsgBox "保存失败,错误代码:" + CStr(retval), vbExclamation, "错误"

End If

End Sub

Private Sub Form_Load()

Dim hkey As Long

Dim lvalue As Long

Dim cddata As Long

Dim retval As Long

retval = RegOpenKeyEx(HKEY_CURRENT_USER, "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", 0, KEY_ALL_ACCESS, hkey)

If retval 0 Then

MsgBox "打开注册表失败,错误代码:" + CStr(retval), vbExclamation, "错误"

End If

retval = RegQueryValueEx(hkey, "NoDriveTypeAutoRun", 0, REG_DWORD, lvalue, 4)

RegCloseKey hkey

If retval 0 Then

MsgBox "读取注册表失败,错误代码:" + CStr(retval), vbExclamation, "错误"

End If

ShowCheck (lvalue)

End Sub

Private Sub ShowCheck(lvalue As Long)

Check0.Value = lvalue Mod 2

lvalue = (lvalue - Check0.Value) / 2

Check1.Value = lvalue Mod 2

lvalue = (lvalue - Check1.Value) / 2

Check2.Value = lvalue Mod 2

lvalue = (lvalue - Check2.Value) / 2

Check3.Value = lvalue Mod 2

lvalue = (lvalue - Check3.Value) / 2

Check4.Value = lvalue Mod 2

lvalue = (lvalue - Check4.Value) / 2

Check5.Value = lvalue Mod 2

lvalue = (lvalue - Check5.Value) / 2

Check6.Value = lvalue Mod 2

End Sub

Private Function GetValue() As Long

GetValue = Check0.Value + Check1.Value * 2 + Check2.Value * 4 + Check3.Value * 8 + Check4.Value * 16 + Check5.Value * 32 + Check6.Value * 64 + 128

End Function

以上。

饿的老狼

vb.net2012的产品密钥是多少?

需要激活的是vs,vb是vs里的集成模板工具

Microsoft Visual Studio Ultimate 2012 旗舰版 有效注册密钥:

YKCW6-BPFPF-BT8C9-7DCTH-QXGWC

- Microsoft Visual Studio Premium 2012 高级版 有效注册密钥:

MH2FR-BC9R2-84433-47M63-KQVWC

- Microsoft Visual Studio Professional 2012 专业版 有效注册密钥:

4D974-9QX42-9Y43G-YJ7JG-JDYBP


分享名称:vb.net注册表密码,vbs注册表
分享链接:http://myzitong.com/article/hocghc.html