I can't seem to view any files that I open. Can soembody take a look for me!
Private Sub Form_Resize()
txtName.Height = Tut07.ScaleHeight
txtName.Width = Tut07.ScaleWidth
End Sub
Private Sub mnuEdit_Click()
If txtName.SelText = "" Then
mnuEditCut.Enabled = False
mnuEditCopy.Enabled = False
Else
mnuEditCut.Enabled = True
mnuEditCopy.Enabled = True
End If
If Clipboard.GetText() = "" Then
mnuEditPaste.Enabled = False
Else
mnuEditPaste.Enabled = True
End If
End Sub
Private Sub mnuEditCopy_Click()
Clipboard.Clear
Clipboard.SetText txtName.SelText
End Sub
Private Sub mnuEditCut_Click()
Clipboard.Clear
Clipboard.SetText txtName.SelText
txtName.SelText = ""
End Sub
Private Sub mnuEditFind_Click()
Const conBtns As Integer = vbOKOnly + vbInformation _
+ vbDefaultButton1 + vbApplicationModal
Const conMsg As String = "The search string was not found."
Dim intRetVal As Integer
Dim intFoundPos As Integer
strSearchFor = InputBox("What word are you looking for", "Find")
intFoundPos = InStr(1, txtName.Text, strSearchFor, 1)
If intFoundPos = 0 Then
intRetVal = MsgBox(conMsg, conBtns, "Find")
Else
txtName.SelStart = intFoundPos - 1
txtName.SelLength = Len(strSearchFor)
End If
End Sub
Private Sub mnuEditFindNext_Click()
Const conBtns As Integer = vbOKOnly + vbInformation _
+ vbDefaultButton1 + vbApplicationModal
Const conMsg As String = "Finally my quest is over."
Dim inRetVal As Integer
Dim intFoundPos As Integer, intBegSearch As Integer
intBegSearch = txtName.SelStart + 2
intFoundPos = InStr(intBegSearch, txtName.Text, strSearchFor, 1)
If intFoundPos = 0 Then
inRetVal = MsgBox(conMsg, conBtns, "Find Next")
Else
txtName.SelStart = intFoundPos - 1
txtName.SelLength = Len(strSearchFor)
End If
End Sub
Private Sub mnuEditPaste_Click()
txtName.SelText = Clipboard.GetText()
End Sub
Private Sub mnuFileExit_Click()
Unload Tut07
End Sub
Private Sub mnuFileNew_Click()
Const conBtns As Integer = vbYesNoCancel + vbExclamation _
+ vbDefaultButton3 + vbApplicationModal
Const conMsg As String = "Do you want to save the current document?"
Dim intUserResponse As Integer
If blnChange = True Then
intUserResponse = MsgBox(conMsg, conBtns, "Editor")
Select Case intUserResponse
Case vbYes
Call mnuFileSave_Click
If blnCancelSave = True Then
Exit Sub
End If
Case vbNo
Case vbCancel
Exit Sub
End Select
End If
txtName.Text = ""
blnChange = False
Tut07.Caption = "Document - Text Editor"
dlgCommon.FileName = ""
End Sub
Private Sub mnuFileOpen_Click()
dlgCommon.Filter = "Text Files(*.txt)|All Files|(*.*)|*.*"
dlgCommon.ShowOpen
End Sub
Private Sub mnuFilePrint_Click()
dlgCommon.Flags = cd1PDNoSelection + cd1PDHidePrintToFile
dlgCommon.ShowPrinter
End Sub
Private Sub mnuFileSave_Click()
dlgCommon.Filter = "Text Files(*.txt)|*.txt"
dlgCommon.ShowSave
End Sub
Private Sub mnuFileSaveAs_Click()
dlgCommon.CancelError = True
dlgCommon.Flags = cd1OFNOverwritePrompt + cd1OFNPathMustExist
dlgCommon.Filter = "Text Files(*.txt)|*.txt"
dlgCommon.ShowSave
Open dlgCommon.FileName For Output As #1
Print #1, txtName.Text
Close #1
Tut07.Caption = dlgCommon.FileName & " - Text Editor"
blnChange = False
blnCancelSave = False
Exit Sub
Dim FileName As String
FileName = dlgCommon.FileName
F = FreeFile
Open FileName For Input As #F
txtName.Text = Input$(LOF(F), F)
Close #F ill post it in 1 minute
- JayWare
Live to love. Not to Hate
Im to busy to have a site. But I got one and still working on it.
http://dre3k.net/