'///导出文件///
Private Sub Command8_Click()
Dim A As String
A = Text1.Text
Dim n
n = MsgBox("是否导出?", 52, "提示信息")
If n = vbYes Then
Open "D:\\" & A & ".rtf" For Output As #1 '新建文件
Print #1, RichTextBox1.Text
Close #1
MsgBox "文件已经存储在D:\,文件名为" & A & "", 64, "提示信息"
ElseIf n = vbNo Then
MsgBox "操作取消", 64, "提示信息"
Exit Sub
End If
End Sub
'///导入文件///
Private Sub Command9_Click()
Open "D:\给疯狂下资料的朋友们提个醒!.txt" For Input As #1
Dim A
Do While EOF(1) = False
Line Input #1, A
RichTextBox1 = RichTextBox1 & A & vbCrLf '这样就好了,要把数据连接起来,否则text只等于最后一行
Loop
Close
End Sub
'///导入文件///
Private Sub mnuOpen_Click()
CommonDialog1.FileName = ""
CommonDialog1.Filter = "*.txt|*.txt|*.rtf|*.rtf|*.*|*.*"
CommonDialog1.DialogTitle = "打开文件"
CommonDialog1.CancelError = True '捕获 取消 错误时得先设置为true 然后再showsave
On Error GoTo ErrorHandler
CommonDialog1.ShowOpen
Text1.Text = Left(CommonDialog1.FileTitle, Len(CommonDialog1.FileTitle) - 4)
RichTextBox1.LoadFile CommonDialog1.FileName, 1
ErrorHandler:
Exit Sub
End Sub
'///选择数据库///
Private Sub SelData_Click()
CommonDialog1.FileName = ""
CommonDialog1.InitDir = App.Path '设置缺省路径
CommonDialog1.Filter = "*.mdb|*.mdb|"
CommonDialog1.DialogTitle = "选择数据库"
CommonDialog1.CancelError = True '捕获 取消 错误时得先设置为true 然后再showsave
On Error GoTo ErrorHandler
CommonDialog1.ShowOpen
entry$ = Trim(CommonDialog1.FileName)
dataname = Trim(CommonDialog1.FileName)
R = WritePrivateProfileString("数据库", "库名", entry, iniPath)
If R <> 1 Then MsgBox "写入出错!"
If selectdate = True Then
Combo1(0).Clear
Call Form_Load
Else
Call Main
End If
ErrorHandler:
Exit Sub
End Sub