Results 1 to 6 of 6

Thread: Can't View After I open

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Location
    NY State
    Posts
    145
    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

    End Sub
    Attached Files Attached Files

  2. #2
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    try adding this to the end of open

    Dim FileName As String
    FileName = dlgCommon.FileName
    F = FreeFile
    Open FileName For Input As #F
    txtName.Text = Input$(LOF(F), F)
    Close #F


    so it would be


    dlgCommon.Filter = "Text Files(*.txt, *.doc)|All Files|(*.*)|*.*"
    dlgCommon.ShowOpen

    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/

  3. #3
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    you have to make the txtname multiline and then you have to change that filter use

    dlgCommon.Filter = "Text Files(*.txt,)|*.txt|Document(*.doc)|All Files|(*.*)|*.*"
    Attached Files Attached Files
    - 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/

  4. #4
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    you have to add to be able to save
    Code:
    FileName = dlgCommon.FileName
        F = FreeFile
        Open FileName For Output As #F
        
        'Strings to Save. Aka Text
        
        Print #F, txtName.Text
        
        Close #F
    if you want me to ill add the save and zip it and post it
    - 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/

  5. #5
    Frenzied Member JasonLpz's Avatar
    Join Date
    Mar 2001
    Location
    Brooklyn, NY
    Posts
    1,335
    if you have any problems with f = freefile or anything else just make a string like

    dim f as string
    ok
    - 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/

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Mar 2001
    Location
    NY State
    Posts
    145
    yeah just zip it.
    cuz now i am really confused as to put where to fix my problem

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width