声明:本作品完全由个人创作,对于应付老师留得软件大作业很有帮助(西工大),本作品仅供个人交流学习,不建议作为商业用途,否则后果自负。
由于vb软件还有很多参数的设定,在此不变于抓图。
因此如果读者完全按照本文档所示结果可能出错,请设置data控件的数据库连接(本作品用access数据库,需要时读者自行建立)以上两个图是程序运行后的部分截图数据库截图(图上的各个名字必须与之对应)Form1截图Form1的代码:Public yonghu As String, mima As StringPublic jibie As Integer '用户的身份级别Dim r0 As Single 'x0,y0为圆心坐标Dim r1 As Single, r2 As Single, r3 As Single 'r0圆半径,r1时钟刻度外圈半径Dim r4 As Single 'r2时钟长刻度内圈半径,r3时钟短刻度内半径Dim r5 As Single, r6 As Single, r7 As Single 'r4时钟标注文字半径,r5时钟时针半径,r6时钟分针半径Dim x0 As Single, y0 As Single 'r7时钟秒针半径Private Sub bangzhu_Click()Form9.ShowEnd SubPrivate Sub bumen_Click()Form6.ShowEnd SubPrivate Sub fangcha_Click()Form2.ShowEnd SubPrivate Sub Form_Load()Label1.Top = 1000 '初始化两个标签的位置Label2.Top = 1000dingwei '将时针,秒针和分针定位到圆心位置jibie = -1yonghu = ""mima = ""End SubPrivate Sub guanli_Click()Form14.ShowEnd SubPrivate Sub Timer1_Timer() '利用定时时钟采用文字的移动Label1.Top = Label1.Top + 10Label2.Top = Label2.Top + 10If Label1.Top = 4700 Then '当文字移到底部时采用重新符值将文字移到顶部Label1.Top = 1000Label2.Top = 1000End IfkeduEnd SubPrivate Sub dingwei() '将时针,秒针和分针定位到圆心位置x0 = Shape1.Left + Shape1.Width / 2y0 = Shape1.Top + Shape1.Height / 2r0 = Shape1.Width / 2r1 = r0r2 = r0 * 0.85r3 = r0 * 0.9r4 = r0 * 0.75r5 = r0 * 0.48r6 = r0 * 0.56r7 = r0 * 0.65Line1.X1 = x0Line2.X1 = x0Line3.X1 = x0Line1.Y1 = y0Line2.Y1 = y0Line3.Y1 = y0End SubPrivate Sub kedu() '绘制时钟刻度Dim i As Single, du As SingleDim X1 As Single, Y1 As Single, X2 As Single, Y2 As SingleFor i = 0 To 354 Step 6du = i * 3.14159 / 180X1 = x0 + r1 * Sin(du)Y1 = y0 - r1 * Cos(du)X2 = x0 + r3 * Sin(du)Y2 = y0 - r3 * Cos(du)Form1.Line (X1, Y1)-(X2, Y2), RGB(0, 0, 200)Next iFor i = 30 To 360 Step 30du = i * 3.14159 / 180Form1.DrawWidth = IIf(i Mod 90 = 0, 3, 2)X1 = x0 + r1 * Sin(du)Y1 = y0 - r1 * Cos(du)X2 = x0 + r2 * Sin(du)Y2 = y0 - r2 * Cos(du)Form1.Line (X1, Y1)-(X2, Y2), RGB(0, 0, 200)X1 = x0 + r4 * Sin(du)Y1 = y0 - r4 * Cos(du)Form1.CurrentX = X1 - 150Form1.CurrentY = Y1 - 100Form1.Print i \ 30Next iEnd SubPrivate Sub Timer2_Timer() '达到指针的动态效果Dim s1 As Single, m1 As Single, h1 As Single, an1 As Single, an2 As Single s1 = Second(Now)m1 = Minute(Now)h1 = Hour(Now)h1 = h1 Mod 12m1 = m1 + s1 / 60h1 = h1 + m1 / 60an2 = h1 * 3.141592653 / 6Line1.X2 = x0 + r5 * Sin(an2)Line1.Y2 = y0 - r5 * Cos(an2)an1 = m1 * 3.14159 / 30Line2.X2 = x0 + r6 * Sin(an1)Line2.Y2 = y0 - r6 * Cos(an1)an1 = s1 * 3.14159 / 30Line3.X2 = x0 + r7 * Sin(an1)Line3.Y2 = y0 - r7 * Cos(an1)End SubPrivate Sub Toolbar1_ButtonClick(ByVal Button As MSComctlLib.Button) Select Case Button.IndexCase 2:Form10.ShowCase 4:Form11.ShowCase 6:Form12.ShowCase 8:Form13.ShowEnd SelectEnd SubPrivate Sub yuangongxx_Click()Form5.ShowEnd SubPrivate Sub yuding_Click()Form3.ShowEnd SubForm2截图Form2代码Private Sub Command1_Click() '上一个Data1.Recordset.MovePreviousIf Data1.Recordset.BOF ThenData1.Recordset.MoveLastEnd IfEnd SubPrivate Sub Command2_Click() '下一个Data1.Recordset.MoveNextIf Data1.Recordset.EOF ThenData1.Recordset.MoveFirstEnd IfEnd SubPrivate Sub Command3_Click() '查询If Option1.Value = True ThenData1.RecordSource = "select * from 房间信息where 房间信息.房间类型= '天'" Data1.RefreshEnd IfIf Option2.Value = True ThenData1.RecordSource = "select * from 房间信息where 房间信息.房间类型= '地'" Data1.RefreshEnd IfIf Option3.Value = True ThenData1.RecordSource = "select * from 房间信息where 房间信息.房间类型= '人'" Data1.RefreshEnd IfIf Option4.Value = True ThenData1.RecordSource = "房间信息"Data1.RefreshEnd IfCommand1.Enabled = TrueCommand2.Enabled = TrueEnd SubPrivate Sub Command4_Click() '结束Unload MeEnd SubPrivate Sub Form_Load()Text1.Enabled = FalseText2.Enabled = FalseText3.Enabled = FalseText4.Enabled = FalseData1.DatabaseName = App.Path & "\酒店管理系统.mdb"End SubPrivate Sub Option1_Click() '天Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Option2_Click() '地Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Option3_Click() '人Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubPrivate Sub Option4_Click() '全部Command1.Enabled = FalseCommand2.Enabled = FalseEnd SubForm3代码Private Sub Command1_Click() 'querenDim a As StringDim b As IntegerIf Text1.Text = "" Or Text2.Text = "" Or Text3.Text = "" Or Text4.Text = "" Or Text5.Text = "" Or Text6.Text = "" ThenMsgBox "信息不完善", , "提示"ElseIf Option6.Value = True Or Option5.Value = True ThenIf Form16.jieguo = 0 ThenMsgBox "如果您是会员或内部人员请先登录!", , "提示"Form16.ShowEnd IfIf Form16.jieguo = 1 Thenb = 1End IfElseb = 1End IfIf b ThenData1.Recordset.AddNewData1.Recordset.Fields("姓名") = Text5.TextData1.Recordset.Fields("房间号") = Text1.TextData1.Recordset.Fields("预定入住时间") = Text2.TextData1.Recordset.Fields("居住时间") = Text3.TextData1.Recordset.Fields("缴纳定金") = Text4.TextData1.Recordset.Fields("性别") = Text6.TextIf Option1.Value = True Thena = "天"End IfIf Option2.Value = True Thena = "地"End IfIf Option3.Value = True Thena = "人"End IfData2.RecordSource = "select * from 房间信息where 房间信息.房间类型='" & a & "' and 房间信息.房间号='" & Text1.Text & "' and 房间信息.状态='可用'"Data2.RefreshIf Data2.Recordset.EOF ThenMsgBox "无此房间或此房间不可用", , "提示"Data1.UpdateControlsElseIf Option1.Value = True ThenData1.Recordset.Fields("房间类型") = "天"End IfIf Option2.Value = True ThenData1.Recordset.Fields("房间类型") = "地"a = "地"End IfIf Option3.Value = True ThenData1.Recordset.Fields("房间类型") = "人"a = "人"End IfIf Option4.Value = True ThenData1.Recordset.Fields("身份") = "普通"End IfIf Option5.Value = True ThenData1.Recordset.Fields("身份") = "会员"End IfIf Option6.Value = True ThenData1.Recordset.Fields("身份") = "内部人员"End IfData2.RecordSource = "select 房间信息.状态from 房间信息where 房间信息.房间类型='" & a & "'and 房间信息.房间号='" & Text1.Text & "'"Data2.Recordset.EditData2.Recordset.Fields("状态") = "预定"Data2.Recordset.UpdateData1.UpdateRecordData1.RefreshMsgBox "预订成功!", , "提示"Form16.jieguo = 0End IfEnd IfEnd IfEnd SubPrivate Sub Command2_Click() 'quxiaoData1.UpdateControlsData2.UpdateControlsEnd SubPrivate Sub Command3_Click() '尚不是会员马上注册Form4.ShowEnd SubPrivate Sub Form_Load()Data1.DatabaseName = App.Path & "\酒店管理系统.mdb"Data2.DatabaseName = App.Path & "\酒店管理系统.mdb"b = 0Form16.jieguo = 0End SubForm4代码Private Sub Adodc1_WillMove(ByVal adReason As ADODB.EventReasonEnum, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)End SubPrivate Sub Command1_Click() 'tijiaoDim a As Stringa = Text1.TextIf Text1.Text <> "" ThenIf Text3.Text = Text2.Text ThenData1.RecordSource = "select * from 会员信息where 会员信息.账号='" & a & "'"Data1.RefreshIf Data1.Recordset.EOF ThenData1.Recordset.AddNewData1.Recordset.Fields("账号") = Text1.TextData1.Recordset.Fields("密码") = Text2.TextData1.Recordset.Fields("邮箱") = Text4.TextData1.UpdateRecordElseMsgBox "此账号已被别人占用", , "提示" '此处用于将会员信息输入数据库GoTo baEnd IfMsgBox "恭喜您顺利成为本酒店会员", , ""Unload MeElseMsgBox "两次输入密码不相符", , "提示"End IfElseMsgBox "帐号不能为空", , "提示"End Ifba:End SubPrivate Sub Command2_Click() 'quexiaoData1.UpdateControlsUnload MeEnd SubPrivate Sub Form_Load()Data1.DatabaseName = App.Path & "\酒店管理系统.mdb"End SubForm5代码Private Sub Command1_Click()Unload MeEnd SubPrivate Sub Form_Load()'Data1.RecordSource = "select 员工信息.姓名,员工信息.部门,员工信息.职位from 员工信息" End SubPrivate Sub Command1_Click() 'liao jie l Unload MeEnd SubPrivate Sub Command2_Click() 'shang yi geAdodc1.Recordset.MovePreviousIf Adodc1.Recordset.BOF ThenAdodc1.Recordset.MoveLastEnd IfEnd SubPrivate Sub Command3_Click() 'xia yi geAdodc1.Recordset.MoveNextIf Adodc1.Recordset.EOF ThenAdodc1.Recordset.MoveFirstEnd IfEnd SubForm7代码Private Sub Command1_Click() 'zeng tianData1.Recordset.AddNewText1.Enabled = TrueText2.Enabled = TrueText3.Enabled = TrueText4.Enabled = TrueText5.Enabled = TrueCommand4.Enabled = TrueCommand5.Enabled = TrueEnd SubPrivate Sub Command2_Click() 'xiu gaiData1.Recordset.EditText1.Enabled = TrueText2.Enabled = TrueText3.Enabled = TrueText4.Enabled = TrueText5.Enabled = TrueCommand4.Enabled = TrueCommand5.Enabled = TrueEnd SubPrivate Sub Command3_Click() 'shan chu Dim a As Integera = MsgBox("确认删除吗", vbYesNo, "提示") If a = vbYes ThenData1.Recordset.DeleteData1.Recordset.MoveFirstEnd IfEnd SubPrivate Sub Command4_Click() 'fang qiData1.UpdateControlsText1.Enabled = FalseText2.Enabled = FalseText3.Enabled = FalseText4.Enabled = FalseText5.Enabled = FalseCommand4.Enabled = FalseCommand5.Enabled = FalseData1.Recordset.MoveFirstEnd SubPrivate Sub Command5_Click() 'que ren Data1.Recordset.UpdateText1.Enabled = FalseText2.Enabled = FalseText3.Enabled = FalseText4.Enabled = FalseText5.Enabled = FalseCommand4.Enabled = FalseCommand5.Enabled = FalseData1.Recordset.MoveFirstEnd SubPrivate Sub Form_Load()Data1.DatabaseName = App.Path & "\酒店管理系统.mdb" End SubForm8代码Public jies As StringPrivate Sub dxx_Click()Form19.ShowEnd SubPrivate Sub fangzong_Click()Form20.ShowEnd SubPrivate Sub Form_Load()Label1.Caption = Form1.yonghu + "欢迎您" End SubPrivate Sub jiesuan_Click()Form22.ShowEnd SubPrivate Sub Label1_Click()End SubPrivate Sub Label2_Click() 'zhu xiao Unload MeForm17.HideForm19.HideForm18.HideForm23.HideForm20.HideForm21.HideForm15.HideForm22.HideForm24.HideForm7.HideEnd SubPrivate Sub lishi_Click()Form23.ShowEnd SubPrivate Sub mimaxiugai_Click()Form24.ShowEnd SubPrivate Sub ruzhu_Click()Form21.ShowEnd SubPrivate Sub yd_Click()Form18.ShowEnd SubPrivate Sub ygwanzheng_Click() Form17.ShowEnd SubPrivate Sub zh_Click()Form15.ShowEnd SubPrivate Sub zhineng_Click() Form7.ShowEnd SubForm9代码Private Sub Command1_Click() Unload MeEnd SubPrivate Sub Form_Load()Text1.Text = " 本系统为本人独立编写,所有密码均为000,在使用过程中可自行更改。