Label1.Caption = "融通系統(tǒng)外掛程序"
創(chuàng)新互聯(lián)于2013年開始,先為藤縣等服務(wù)建站,藤縣等地企業(yè),進行企業(yè)商務(wù)咨詢服務(wù)。為藤縣企業(yè)網(wǎng)站制作PC+手機+微官網(wǎng)三網(wǎng)同步一站式服務(wù)解決您的所有建站問題。
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
直接添加一個MID父窗體或在已有窗體的屬性中找到IsMDIContainer屬性,然后設(shè)置為True,然后創(chuàng)建第二個窗體 ,需要加載子窗體的時候:
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子窗體,則創(chuàng)該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子窗體,設(shè)為激活?并退出循環(huán)
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
dim 一個窗體 as new form
with 一個窗體
.location=...
.size=...'這里是設(shè)置窗體的位置等屬性
end with
一個窗體.show
可以實現(xiàn)
搞個button,點擊的時候連接數(shù)據(jù)庫,寫入數(shù)據(jù)
再搞個button,點擊的時候,連接數(shù)據(jù)庫,查詢數(shù)據(jù),顯示在datagridview里面(將查詢到的數(shù)據(jù)存在datatable中,再把datatable賦給datagridview的datasource就可以了)