精华内容
下载资源
问答
  • vb.net用户界面设计

    2015-09-03 12:44:48
    vb.net用户界面设计程序代码压缩包,仅供参考
  • VB登陆界面代码 登录界面

    热门讨论 2010-09-13 13:34:25
    VB登录 代码 怎么做登录对话框 简单的VB登录对话框
  • 该楼层疑似违规已被系统折叠隐藏此楼查看此楼'**************************************** Module1.bas 模块代码'工程 上面按下右键 工程1属性 设定以 Main 启动Option ExplicitPublic Declare Function ...

    该楼层疑似违规已被系统折叠 隐藏此楼查看此楼

    '**************************************** Module1.bas 模块代码

    '工程 上面按下右键 工程1属性 设定以 Main 启动

    Option Explicit

    Public Declare Function MessageBoxTimeout Lib "user32" Alias "MessageBoxTimeoutA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long, ByVal wlange As Long, ByVal dwTimeout As Long) As Long

    Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Long

    Public Declare Function SetWindowRgn Lib "user32" (ByVal hwnd As Long, ByVal hRgn As Long, ByVal bRedraw As Boolean) As Long

    Public Declare Function CreateRoundRectRgn Lib "gdi32" (ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long, ByVal X3 As Long, ByVal Y3 As Long) As Long

    Public Declare Function SetLayeredWindowAttributes Lib "user32" (ByVal hwnd As Long, ByVal crKey As Long, ByVal bAlpha As Byte, ByVal dwFlags As Long) As Long

    Public Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long

    Public Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long

    Public CONN As New ADODB.Connection '定义数据连接字符串

    Public RS As New ADODB.Recordset '定义记录集

    Public Const WS_EX_LAYERED = &H80000

    Public Const GWL_EXSTYLE = (-20)

    Public Const LWA_ALPHA = &H2

    Public Const LWA_COLORKEY = &H1

    Public Const vbKeyAlt = vbKeyMenu

    Public AppDisk$, DataDisk$, DB$, MsgTitle$, UserName$, PassWord$, UserLevel$

    Public LoginYn As Boolean

    Public Rtn&, ErrPass&

    Sub Main()

    MsgTitle = "数据库登录练习" '项目名称赋值给变量 MsgTitle

    '禁止两次运行本程序

    If App.PrevInstance Then Call MsgBox("对不起本程序已在运行中, 不得重复加载!!", vbCritical, MsgTitle): End

    AppDisk = IIf(Right(App.Path, 1) = "\", App.Path, App.Path & "\") '本地路径赋值给变量AppDisk

    DataDisk = AppDisk & "Data\" '将本地路径下的DATA文件夹赋值给变量DataDisk

    If Dir(DataDisk, vbDirectory) = "" Then MkDir DataDisk '如果DataDisk变量指定的文件夹不存在则创建它

    MainForm.Show '运行主程序MainForm

    Log.Show '运行登录程序Log

    End Sub

    '以搜索关键字词在数据库某个表,某个字段查找 返回真或假的副程序

    Public Function SearchDATA(TMPRS As Object, SchZD As String, SchData As String) As Boolean

    On Error Resume Next

    SearchDATA = False '初始查找变量 SearchDATA为 假

    TMPRS.MoveFirst '查找到之后 记录移到第一笔

    TMPRS.Find SchZD & " = " & Chr(39) & SchData & Chr(39)

    If Not TMPRS.EOF Then SearchDATA = True '如果查找到 则 SearchDATA函数返回 真

    End Function

    Public Sub RoundWin(Tform As Object, WW&, HH&) '创建圆角窗体的副程序

    Dim W&, H&

    On Error Resume Next

    W = Tform.Width \ Screen.TwipsPerPixelX '将窗体的宽度除以屏幕每个像素点的值(15) 转换为像素,带入变量W

    H = Tform.Height \ Screen.TwipsPerPixelY '将窗体的高度除以屏幕每个像素点的值(15) 转换为像素,带入变量H

    SetWindowRgn Tform.hwnd, CreateRoundRectRgn(0, 0, W, H, WW, HH), True '以带进之参数WW与HH创建窗体圆角

    Tform.Move (Screen.Width - Tform.Width) \ 2, (Screen.Height - Tform.Height) \ 2 '窗体居于屏幕中心

    End Sub

    Public Sub CleanAll() '结束程序退出的副程序

    On Error Resume Next

    '关闭所有打开的窗体并释放对象

    Dim TmpFrm As Form

    For Each TmpFrm In Forms

    Unload TmpFrm

    Set TmpFrm = Nothing

    Next

    End '结束程序退出

    End Sub

    展开全文
  • vb制作登陆界面

    2013-04-21 18:31:21
    指导用户利用VB ADODB进行远程登陆,源代码
  • vb登陆界面代码

    2018-04-18 14:46:43
    制作简单的vb登陆界面代码,适合初学Private Sub Command1_Click() If Text1 = "" Or Text2 = "" Then MsgBox "用户名或密码不能为空", vbOKOnly + vbInformation, "提示" Exit Sub End If
  • vb.net登陆界面

    2020-04-27 19:14:02
    今天我们来做一个登陆窗体,下面请看源码哦: Imports System.Data Imports System.Data.OleDb Public Class Login Inherits System.Windows.Forms.Form Dim ServerLog As New AddServer Dim StrServer As String = ...

    今天我们来做一个登陆窗体,下面请看源码哦:

     Imports System.Data
    Imports System.Data.OleDb
    
    Public Class Login
         Inherits System.Windows.Forms.Form
    Dim ServerLog As New AddServer
       Dim StrServer As String = ServerLog.TSever.Text
       Private Conn As New OleDbConnection("Integrated Security=SSPI;Packet Size=4096;Data Source='" & StrServer & "';Tag with column collation when possible=False;Initial Catalog=ys;Use Procedure for Prepare=1;Auto Translate=True;Persist Security Info=False;Provider=SQLOLEDB.1;Workstation ID='" & StrServer & "';Use Encryption for Data=False")
       Private DC As New OleDbConnection
       Private DA As New OleDbDataAdapter
       Private DS As New DataSet
       Dim Adminform As New Administrator
       Dim stuform As New student
       Dim Teaform As New Teacher
     
       Private Function Query(ByVal QueryString As String) As Boolean
           DS.Clear()
           Try
               DA = New OleDbDataAdapter(QueryString, Conn)
               DA.Fill(DS, "TMInfo")
           Catch
               MessageBox.Show(Err.Description, "警告", _
               MessageBoxButtons.OK, MessageBoxIcon.Warning)
               Exit Function
           End Try
           Dim dt As New DataTable
           dt = DS.Tables.Item(0)
    
           If account.Text = "" Or passwords.Text = "" Then
               MessageBox.Show(" 账号或密码不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)
               Return False
           ElseIf dt.Rows.Count = 0 Then
               '错误
               MessageBox.Show( _
                       "您输入的账号不存在", _
                       "警告", MessageBoxButtons.OK, MessageBoxIcon.Error)
               Return False
           End If
           Dim row As Data.DataRow
           '定义一个表格行对象。
           row = dt.Rows.Item(0)
           '将表格的第一行即密码读出
           'passwords.Text = row.Item("password")
           If passwords.Text <> row.Item("password") Then
               '用户的密码不正确
               MessageBox.Show( _
               "对不起,您的密码有误。", _
               "警告", MessageBoxButtons.OK, MessageBoxIcon.Error)
               Return False
     
           End If
     
           Return True
       End Function
       Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
           Dim QueryString As String
           QueryString = "select * from TeaMagInfo where id='" & account.Text & "'"
           If account.Text = "Administrator" And passwords.Text = "pass" Then
               Dim Addserv As New AddServer
               Addserv.ShowDialog()
           Else
               If (Query(QueryString) = True) Then
     
                   Try
                       DA = New OleDbDataAdapter(QueryString, Conn)
                       DA.Fill(DS, "TMInfo")
                   Catch
                       MessageBox.Show(Err.Description, "警告", _
                       MessageBoxButtons.OK, MessageBoxIcon.Warning)
                       Exit Sub
                   End Try
                   Dim dt As New DataTable
                   dt = DS.Tables.Item(0)
                   Dim row As Data.DataRow
                   '定义一个表格行对象。
                   row = dt.Rows.Item(0)
                   If RadioAdmin.Checked Then
                       If row.Item("ocu") <> "管理员".ToString Then
                           MessageBox.Show("你选择的用户类型不正确", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)
                       Else
                           Adminform.Show()
                           Me.Visible = False
                       End If
                   End If
                   If RadioTeacher.Checked Then
                       If row.Item("ocu") <> "教师".ToString Then
                           MessageBox.Show("你选择的用户类型不正确", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)
                       Else
     
                           ' Me.Visible = False
                           Me.DialogResult = DialogResult.OK
                           Teaform.Show()
                           Me.Visible = False
                       End If
                   End If
     
     
               End If
           End If
           If Radiostu.Checked Then
               DS.Clear()
               If account.Text = "" Or passwords.Text = "" Then
                   MessageBox.Show(" 账号或密码不能为空", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)
               Else
                   Dim stu As Boolean = False
                   Dim QuerString As String
                   QuerString = "select * from stuBaseInfo where stuID='" & account.Text & "'and password='" & passwords.Text & "'"
                   Try
                       DA = New OleDbDataAdapter(QuerString, Conn)
                       DA.Fill(DS, "lk")
                       Dim dtab As DataTable
                       dtab = DS.Tables.Item("lk")
                       If dtab.Rows.Count <> 0 Then
                           stu = True
                       Else
                           MessageBox.Show("不存在此账号信息或原始密码错", "提示信息", MessageBoxButtons.OK, MessageBoxIcon.Information)
                       End If
                   Catch ex As Exception
                       MessageBox.Show(Err.Description, "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning)
                   End Try
                   If stu Then
                       stuform.Show()
                       Me.Visible = False
                   End If
               End If
           End If
       End Sub
     
       Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
           Me.Close()
     
       End Sub
     
       Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
           Me.AcceptButton = Button1
           Me.CancelButton = Button2
     
       End Sub
     
       Private Sub OleDbConnection1_InfoMessage(ByVal sender As System.Object, ByVal e As System.Data.OleDb.OleDbInfoMessageEventArgs)
     
       End Sub
     
       Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Radiostu.CheckedChanged
     
       End Sub
     
       Private Sub RadioTeacher_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioTeacher.CheckedChanged
     
       End Sub
    End Class
    
    展开全文
  • vb.net登录界面是利用面向对象的思维设计的,实现了简单的登录操作。走向程序员这条路不容易,从简单到复杂这是不可缺少的。一步一个台阶。加油!
  • vb.net 登陆界面修改密码.doc非常好的资原,拿出来与大家分享!
  • vb登陆界面设计

    千次阅读 2016-05-26 18:11:40
    VB新建一个工程,在窗体Form1上画两个label控件,一个是Label1一个是Label2,把Label1的Caption属性设为“用户名”,Label2的Caption属性设为“密码”,然后分别在这俩Label右边各画一个textbox控件,一个叫Text1...
    用VB新建一个工程,在窗体Form1上画两个label控件,一个是Label1一个是Label2,把Label1的Caption属性设为“用户名”,Label2的Caption属性设为“密码”,然后分别在这俩Label右边各画一个textbox控件,一个叫Text1,一个叫Text2,把Text2的PasswordChar属性设为“*”,同时把两个Textbox的Text属性设为空(就是都清空),然后在窗体的下部合适的位置画两个CommandButton控件,一个叫Command1,另一个叫Command2,分别设置他们的Caption属性为“确定”和“取消”。
    界面就画完了,下面是代码。
       先点菜单项里的工程下面的引用,找到Activex Data Objects 2.6或以上版本的类库,选中前面的对勾,然后确定,该操作是用来引用ADO对象的。
       双击确定按钮,写入以下代码。
         dim conn as new adodb.connection
         dim rs as new adodb.recordset
         
         if text1.text="" or text2.text="" then
             msgbox "对不起,用户名与密码不能为空",vbinformation,"输入错误"
             exit sub
         end if
         
         conn.connectionstring="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=(这里去掉括号写入你的数据库文件路径形如:c:\aaa\bbb.mdb,这是Access数据库的用法);Persist Security Info=False"
    
    conn.open
    rs.open "select * from tbl_user where username='" & text1.text & "' and password='" & text2.text & "'",conn,3,3
    if rs.recordcount<>0 then
       '此处加入登录完成后要执行的操作,如果是要显示form2则参考下文
       load form2
       form2.show
       rs.close
       conn.close
       unload me
       else
       '此处为密码验证失败。
        msgbox "对不起,登录失败",vbinforamtion,"提示"
        rs.close;
        conn.close;
        exit sub
    end if
    
    展开全文
  • vb卡发的简单用户登陆界面,只有简单的代码,界面也没有优化
  • "(" & myreader("姓名").ToString.Trim & ")" Me.Close() FormMain.MenuStrip1.Visible = True FormMain.ToolStrip1.Visible = True If myreader("激活状态").ToString.Trim = "0" Then MsgBox("检测到该用户首次...
        Private Sub OK_Click(sender As Object, e As EventArgs) Handles OK.Click
            If TextBox1.Text = "" Then
                MsgBox("用户名不能为空!!", , "提示")
            ElseIf TextBox2.Text = "" Then
                MsgBox("密码不能为空!!", , "提示")
            Else
                Dim sql As String = "select * from 人员表 where 用户名='" & TextBox1.Text.ToString.Trim & "' and 密码='" & TextBox2.Text.ToString.Trim & "'"
                Dim mycmd As New SqlCommand(sql, conn)
                Dim myreader As SqlDataReader
                myreader = mycmd.ExecuteReader
                If myreader.HasRows Then
                    myreader.Read()
                    MsgBox("登录成功!!", , "标题")
                    yonghuming = myreader("用户名").ToString.Trim
                    xingming = myreader("姓名").ToString.Trim
                    bumen = myreader("部门").ToString.Trim
                    FormMain.ToolStripStatusLabel3.Text = myreader("用户名").ToString.Trim & "(" & myreader("姓名").ToString.Trim & ")"
                    Me.Close()
                    FormMain.MenuStrip1.Visible = True
                    FormMain.ToolStrip1.Visible = True
                    If myreader("激活状态").ToString.Trim = "0" Then
                        MsgBox("检测到该用户首次登录,必需将初始密码修改!!", , "标题")
                        FormPassword.MdiParent = FormMain
                        FormPassword.Show()
                        FormPassword.TextBox1.Text = yonghuming & "(" & xingming & ")"
                    ElseIf myreader("激活状态").ToString.Trim = "1" Then
                        Me.Close()
                        FormMain.MenuStrip1.Visible = True
                        FormMain.ToolStrip1.Visible = True
                    End If
                Else
                    MsgBox("输入用户名或密码错误,请重新输入!!", , "标题")
                    TextBox1.Text = ""
                    TextBox2.Text = ""
                    TextBox1.Focus()
                End If
                myreader.Close()
            End If
        End Sub

     

    展开全文
  • 满意答案haofg5022013.11.28采纳率:56%等级:12已帮助:9741人给你一个VB链接数据库的代码第一步:工程--microsoft activex data objects2.8 library '引用这个第二步:就是下面的代码 复制进去,注意你的SQL有没有...
  • vb2008 做登陆界面 用sql和数据库连接 急!关注:72答案:3mip版解决时间 2021-01-18 03:39提问者妳有我霸氣嗎2021-01-17 19:30我是个新手,都不太懂。现在要做一个vb登陆界面,用户名和密码的,然后和数据库连接...
  • vb登录界面编写

    千次阅读 2019-05-12 16:27:29
    VB 登录界面编写 登录界面展示(此篇只有登录代码) 登录代码 Private Sub Command1_Click() 'command1是登录的按钮 Dim no,np, np,np, i%, j%, b%, p% b = 0 p = 0 If Text1.text = “” Then 'text1是用户名的...
  • VB制作登录界面

    2021-06-30 21:00:33
    打开VB,新建标准EXE工程,如下图 调整窗口大小,把backcolor属性调整为&H00FFFF00&,然后把form1窗口编辑成如下图的样子。 (注意:label控件的autosize属性要设为true,密码text输入框的...
  • vb.net登录页面

    2018-06-29 10:13:22
    vb.net制作用户登录界面的思路和大致的代码,调试通过
  • 要想做好一个完整的登陆界面就需要到数据库,因为它们是一个整体,少了任何一样都没法说是一个完整的程序,我现在的这个还是不算完整的,我现在还没有想好里面的内容需要添加一些什么,我本来是是这样打算的,想在...
  • Excelvba 登陆界面

    2012-11-11 23:34:38
    Excelvba 登陆界面 包含代码
  • vb 登陆窗体

    2013-06-20 14:11:53
    自己用visual basic6.0 编写的登陆窗体,很简单。代码注释里有用户名和密码。
  • VB.NET用户登录(三层架构思想)

    热门讨论 2011-12-29 16:18:09
    学习是一步一个台阶的,用面向过程的思想实现vb.net用户登录实际上很简单,但是高内聚、低耦合的原则给丢了,这个Demo主要实现了三层架构思想来实现用户登录。
  • 我要做一个VB+SQL的图书管理系统,但是在用户登录窗口处被卡住了,求各位大虾们帮帮忙!界面上只用输入用户名和密码,数据库是tsglxt_Data,表名为user,表中用户名是userName,密码是passwo...我要做一个VB+SQL的图书管理...
  • 基于vb+access的用户登录界面设计,很值得学习
  • VB+Access登录界面(源码)

    热门讨论 2010-01-13 11:04:57
    VB6.0+ Access写的带验证码的登录源码
  • 对于窗口界面的设计,主要根据用户的需求来做,用户至上嘛,在这里我就做了个简单的界面,主要以实现它的功能为主,窗体界面设计如图: 2.主要实现的功能单击确定按钮时,上机成功,弹出“登陆成功!”,否则弹出...

空空如也

空空如也

1 2 3 4 5 ... 20
收藏数 3,025
精华内容 1,210
关键字:

vb用户登录界面