vb.net创建一个窗口 vbnet ui
如何用VB.net连接数据库做一个简单的登陆窗口?
Label1.Caption = "融通系统外挂程序"
创新互联于2013年开始,先为藤县等服务建站,藤县等地企业,进行企业商务咨询服务。为藤县企业网站制作PC+手机+微官网三网同步一站式服务解决您的所有建站问题。
If Dir(App.Path "/hjw.mdb") "" Then
Set mydata = OpenDatabase(App.Path "\hjw")
Set myrs1 = mydata.OpenRecordset("user", dbOpenTable)
Else
Set mydata = CreateDatabase(App.Path "\hjw", dbLangGeneral, dbVersion40)
mydata.Execute "create table ku (建立日期 text(100),库名 text(100),功能 text(100))"
mydata.Execute "create table system (店号 integer,建立日期 text(100),文件路径 text(100),软件版本 text(100),路径1 text(50),路径2 text(50),路径3 text(50),路径4 text(50))"
kuname = "system"
kugn = "文件信息"
Me.showlist1
mydata.Execute "create table user (user text(50),passwd text(50),name text(50),quanx integer)"
kuname = "user"
kugn = "用户信息"
Me.showlist1
Private Sub cmdOK_Click()
txtUserName.SetFocus
If Trim(txtUserName.Text = "") Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
sql = "select * from user where user = '" txtUserName.Text "'"
'Debug.Print sql
'Set mrc = ExecuteSQL(sql, MsgText)
Set myrs2 = mydata.OpenRecordset(sql)
If myrs2.EOF = True Then
MsgBox "没有这个用户,请重新输入用户名!", vbOKOnly + vbExclamation, "警告"
txtUserName.SetFocus
Else
If Trim(myrs2.Fields(1)) = Trim(txtPassword.Text) Then
UserName = myrs2.Fields(2)
myrs2.Close
Me.Hide
' UserName = Trim(txtUserName.Text)
'Debug.Print UserName
MDIform1.Show
Else
MsgBox "输入密码不正确,请重新输入!", vbOKOnly + vbExclamation, "警告"
txtPassword.SetFocus
txtPassword.Text = ""
End If
End If
End If
End Sub
如何给VB.NET窗体添加子窗体?
直接添加一个MID父窗体或在已有窗体的属性中找到IsMDIContainer属性,然后设置为True,然后创建第二个窗体 ,需要加载子窗体的时候:
Dim NewMDIChild As New Form2
NewMDIChild.MdiParent = Me
NewMDIChild.Show()
Public Shared Sub CheckMDIChildForm(ByVal MDIForm As Windows.Forms.Form, ByVal MDIChildForm As Windows.Forms.Form, ByVal MDIChildFormName As String)
If MDIForm.MdiChildren.Length 1 Then
'如果没有任何一个MDI子窗体,则创该MDI子窗体的窗体实例
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
Exit Sub
Else
Dim x As Integer
Dim frmyn As Boolean
For x = 0 To (MDIForm.MdiChildren.Length) - 1
Dim tempChild As Windows.Forms.Form = CType(MDIForm.MdiChildren(x), Windows.Forms.Form)
If tempChild.Name = MDIChildFormName Then
'检测到有该MDI子窗体,设为激活 并退出循环
frmyn = True
tempChild.BringToFront()
Exit For
Else
frmyn = False
End If
Next
If Not frmyn Then
'在打开的窗体中没检测到则新建
Dim MDIChildFrm As Windows.Forms.Form = MDIChildForm ' 定义MDI子窗体
MDIChildFrm.MdiParent = MDIForm '指定父窗体
MDIChildFrm.Show() '打开窗体
End If
End If
End Sub
如何创建vb.net窗体
dim 一个窗体 as new form
with 一个窗体
.location=...
.size=...'这里是设置窗体的位置等属性
end with
一个窗体.show
我想用vb.net做一个Windows窗口应用程序;
可以实现
搞个button,点击的时候连接数据库,写入数据
再搞个button,点击的时候,连接数据库,查询数据,显示在datagridview里面(将查询到的数据存在datatable中,再把datatable赋给datagridview的datasource就可以了)
新闻标题:vb.net创建一个窗口 vbnet ui
网站URL:http://azwzsj.com/article/ddcdijj.html