作品展
作品展跟以前的憧憬还是差一些,不过也把自己学到的东西运用起来,也是对我们这个团队的一个体现,也谢谢3人的努力吧。也可以在家长面前展示半年的成果,很满足,很知足。
首先谈一谈这次作品的思想,首先软件都是极简注意,多一点花里花哨的东西我都不喜欢,但是为了在大家家长面前展示不那么单调,还是添加一些Flash。
这次的编写大同小异的都是vb6.0+flash,我可能跟其他有些差异的运用了vb6.0+sqlserver,这也是我半年学习到的东西,合理运用也是对自己成长的一种变现。
刚开始大家都为怎么做,做什么,做成什么样子都讨论过,开始也没有很好的打算,在最后半个月才讨论出结果,我也自己为自己画了一个草图,这次我也是主刀的代码手。
接下来展示下我们的小软件
这属于一个计划提醒的软件,对数据库的增删改查,不多讲了大家都懂,代码贴出来让大家指导,谢谢。
Private Sub Command1_Click()
Dim i As Integer
Dim j As Integer
Dim xlApp As Excel.Application
Dim xlBook As Excel.Workbook
Dim xlSheet As Excel.Worksheet
FileName = "C:\Users\ThinkPad\Desktop\25\Jihua1.xls"
If msf1.Text = "" Then
MsgBox "没有记录可导出!", vbOKOnly + vbExclamation, "警告"
Exit Sub
Else
If Dir(FileName) = "" Then
Set xlApp = CreateObject("excel.application")
xlApp.Visible = True
Set xlBook = xlApp.Workbooks.Add
Set xlSheet = xlBook.Worksheets(1)
For i = 0 To msf1.Rows - 1
For j = 0 To msf1.Cols - 1
msf1.Row = i
msf1.Col = j
xlSheet.Cells(i + 1, j + 1) = Trim(msf1.Text)
Next
Next
xlBook.SaveAs "C:\Users\ThinkPad\Desktop\25\Jihua1.xls"
xlBook.Close
End If
End If
End Sub
Private Sub Command2_Click()
Dim mrc As ADODB.Recordset
Dim txtsql As String
Dim msgtext As String
Dim mrc1 As ADODB.Recordset
Dim txtsql1 As String
Dim msgtext1 As String
txtsql = "select * from plan_info where name='" & username & " '"
Set mrc = ExecuteSQL(txtsql, msgtext)
If DTP1.Value = "" Then
MsgBox "请选择日期", vbOKOnly + vbExclamation, "提示"
DTP1.SetFocus
Exit Sub
End If
If Trim(cb1.Text) = "" Then
MsgBox "请选择任务开始时间!", vbOKOnly + vbExclamation, "提示"
cb1.SetFocus
Exit Sub
End If
If Trim(cb2.Text) = "" Then
MsgBox "请选择任务结束时间!", vbOKOnly + vbExclamation, "提示"
Else
If Format(cb2.Text) <= Format(cb1.Text) Then
MsgBox "任务结束时间不能早于开始时间,请重新调整~!", vbOKOnly + vbExclamation, "提示"
cb2.SetFocus
Exit Sub
Else
If Trim(txtdata.Text) = "" Then
MsgBox "请输入内容!", vbOKOnly + vbExclamation, "提示"
txtdata.SetFocus
Exit Sub
Else
txtsql1 = "select * from plan_info where name='" & Label1.Caption & " 'and JDate=' " & Format(DTP1.Value) & "' and BTime=' " & Format(cb1.Text) & "'and etime =' " & Format(cb2.Text) & "'"
Set mrc1 = ExecuteSQL(txtsql1, msgtext1)
If mrc1.EOF = False And Trim(cb3.Text) = "计划内容" Then
mrc1.Fields(4) = Trim(txtdata.Text)
mrc1.Update
mrc1.Close
MsgBox "添加成功", vbOKOnly + vbExclamation, "提示"
Exit Sub
Else
If mrc1.EOF Then
mrc.AddNew
mrc.Fields(0) = username
mrc.Fields(1) = Format(DTP1.Value)
mrc.Fields(2) = Format(cb1.Text)
mrc.Fields(3) = Format(cb2.Text)
mrc.Fields(4) = txtdata.Text
mrc.Fields(5) = "未反馈"
mrc.Fields(6) = "未总结"
mrc.Update
mrc.Close
MsgBox "添加成功", vbOKOnly + vbExclamation, "提示"
Exit Sub
Else
If Trim(cb3.Text) = "完成情况" Then
mrc1.Fields(5) = Trim(txtdata.Text)
mrc1.Update
mrc1.Close
MsgBox "修改成功", vbOKOnly + vbExclamation, "提示"
Exit Sub
Else
If Trim(cb3.Text) = "总结" Then
mrc1.Fields(6) = Trim(txtdata.Text)
mrc1.Update
mrc1.Close
MsgBox "总结完成", vbOKOnly + vbExclamation, "提示"
End If
End If
End If
End If
End If
End If
End If
End Sub
Private Sub form_load()
DTP1.Value = Date
Label1.Caption = username
cb1.AddItem "8:00:00"
cb1.AddItem "8:30:00"
cb1.AddItem "9:00:00"
cb1.AddItem "9:30:00"
cb1.AddItem "10:00:00"
cb1.AddItem "10:30:00"
cb1.AddItem "11:00:00"
cb1.AddItem "11:30:00"
cb1.AddItem "11:50:00"
cb1.AddItem "14:00:00"
cb1.AddItem "14:30:00"
cb1.AddItem "15:00:00"
cb1.AddItem "15:30:00"
cb1.AddItem "16:00:00"
cb1.AddItem "16:30:00"
cb1.AddItem "17:00:00"
cb1.AddItem "17:30:00"
cb1.AddItem "19:00:00"
cb1.AddItem "19:30:00"
cb1.AddItem "20:00:00"
cb1.AddItem "20:30:00"
cb1.AddItem "21:00:00"
cb1.AddItem "21:30:00"
cb2.AddItem "8:30:00"
cb2.AddItem "9:00:00"
cb2.AddItem "9:30:00"
cb2.AddItem "10:00:00"
cb2.AddItem "10:30:00"
cb2.AddItem "11:00:00"
cb2.AddItem "11:30:00"
cb2.AddItem "11:50:00"
cb2.AddItem "14:00:00"
cb2.AddItem "14:30:00"
cb2.AddItem "15:00:00"
cb2.AddItem "15:30:00"
cb2.AddItem "16:00:00"
cb2.AddItem "16:30:00"
cb2.AddItem "17:00:00"
cb2.AddItem "17:30:00"
cb2.AddItem "19:00:00"
cb2.AddItem "19:30:00"
cb2.AddItem "20:00:00"
cb2.AddItem "20:30:00"
cb2.AddItem "21:00:00"
cb2.AddItem "21:30:00"
cb3.AddItem "计划内容"
End Sub
Private Sub form_click()
Dim msgtext As String
Dim mrc As ADODB.Recordset
Dim txtsql As String
Dim msgtext1 As String
Dim mrc1 As ADODB.Recordset
Dim txtsql1 As String
Dim i As Integer
'frmpic.Visible = False
DTP1.Enabled = True
cb1.Enabled = True
cb2.Enabled = True
cb3.Enabled = True
DTP1.Value = Date
cb1.Text = Time
cb2.Text = Time
cb3.Text = "计划内容"
txtdata.Text = "输入计划内容"
txtsql = "select * from plan_info where name='" & username & "'order by JDate" '以时间排序查询
Set mrc = ExecuteSQL(txtsql, msgtext)
txtsql1 = "select * from plan_info where name='" & username & " 'and JDate=' " & Format(Date) & "'" '多条件查询
Set mrc1 = ExecuteSQL(txtsql1, msgtext1)
If Check1.Value = 1 Then
With msf1
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "名称"
.TextMatrix(0, 1) = "日期"
.TextMatrix(0, 2) = "开始时间"
.TextMatrix(0, 3) = "结束时间"
.TextMatrix(0, 4) = "计划内容"
.TextMatrix(0, 5) = "完成情况"
.TextMatrix(0, 6) = "总结"
.ColWidth(4) = 1500
.ColWidth(5) = 1300
Do While Not mrc1.EOF
.Rows = .Rows + 1
.CellAlignment = 4
'显示数据
.TextMatrix(.Rows - 1, 0) = Trim(mrc1.Fields(0)) '循环遍历数据显示
.TextMatrix(.Rows - 1, 1) = Trim(mrc1.Fields(1))
.TextMatrix(.Rows - 1, 2) = Trim(mrc1.Fields(2))
.TextMatrix(.Rows - 1, 3) = Trim(mrc1.Fields(3))
.TextMatrix(.Rows - 1, 4) = Trim(mrc1.Fields(4))
.TextMatrix(.Rows - 1, 5) = Trim(mrc1.Fields(5))
.TextMatrix(.Rows - 1, 6) = Trim(mrc1.Fields(6))
mrc1.MoveNext
Loop
End With
Exit Sub
Else
With msf1
.Rows = 1
.CellAlignment = 4
.TextMatrix(0, 0) = "名称"
.TextMatrix(0, 1) = "日期"
.TextMatrix(0, 2) = "开始时间"
.TextMatrix(0, 3) = "结束时间"
.TextMatrix(0, 4) = "计划内容"
.TextMatrix(0, 5) = "完成情况"
.TextMatrix(0, 6) = "总结"
.ColWidth(4) = 1500
.ColWidth(5) = 1300
Do While Not mrc.EOF
.Rows = .Rows + 1
.CellAlignment = 4
'显示数据
.TextMatrix(.Rows - 1, 0) = Trim(mrc.Fields(0))
.TextMatrix(.Rows - 1, 1) = Trim(mrc.Fields(1))
.TextMatrix(.Rows - 1, 2) = Trim(mrc.Fields(2))
.TextMatrix(.Rows - 1, 3) = Trim(mrc.Fields(3))
.TextMatrix(.Rows - 1, 4) = Trim(mrc.Fields(4))
.TextMatrix(.Rows - 1, 5) = Trim(mrc.Fields(5))
.TextMatrix(.Rows - 1, 6) = Trim(mrc.Fields(6))
mrc.MoveNext
Loop
End With
End If
End Sub
Private Sub Label5_Click()
frmsm.Show
End Sub
Private Sub msf1_Click()
Select Case msf1.Col
Case "4"
cb3.Text = "计划内容"
Case "5"
cb3.Text = "完成情况"
Case "6"
cb3.Text = "总结"
End Select
With msf1
If msf1 = "" Then '判断msf1是否为空
MsgBox "请点击窗体查询!", vbOKOnly + vbExclamation, "提示"
DTP1.Value = Format(Date) 'DTP1.Value = .TextMatrix(.Row, 1) 错误调整
Label1.Caption = .TextMatrix(.Row, 0)
cb1.Text = .TextMatrix(.Row, 2)
cb2.Text = .TextMatrix(.Row, 3)
txtdata.Text = Trim(.Text)
Else
DTP1.Value = .TextMatrix(.Row, 1)
Label1.Caption = .TextMatrix(.Row, 0)
cb1.Text = .TextMatrix(.Row, 2)
cb2.Text = .TextMatrix(.Row, 3)
txtdata.Text = Trim(.Text)
End If
End With
DTP1.Enabled = False
cb1.Enabled = False
cb2.Enabled = False
End Sub
Private Sub Timer1_Timer()
'条件查询到时间提醒
Dim txtsql As String
Dim msgtext As String
Dim mrc As ADODB.Recordset
Dim txtsql1 As String
Dim msgtext1 As String
Dim mrc1 As ADODB.Recordset
lbltime.Caption = Time
'查询开始时间语句
txtsql = "select * from plan_info where name='" & username & " 'and JDate=' " & Format(DTP1.Value) & "'and Btime=' " & Time & " '"
Set mrc = ExecuteSQL(txtsql, msgtext)
'查询结束时间语句
txtsql1 = "select * from plan_info where name='" & username & " 'and JDate=' " & Format(DTP1.Value) & "'and Etime=' " & Time & " '"
Set mrc1 = ExecuteSQL(txtsql1, msgtext1)
If Check2.Value = 1 And mrc.EOF = False Then '开始提醒显示
frm31.Show
Exit Sub
Else
If Check2.Value = 1 And mrc1.EOF = False Then ' 结束提醒显示
frm21.Show
Exit Sub
Else
On Error Resume Next
End If
End If
End Sub
谢谢