Results 1 to 4 of 4

Thread: OpenFileDialog and SaveFileDialog

  1. #1

    Thread Starter
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301

    Question OpenFileDialog and SaveFileDialog

    what code do you use for the openfiledialog and savefiledialog, For a PocketPC app, I tryed what I know for vb.net but it dosent work, if you have already guess im a total noob in mobile Development.

    Im using Visual Basic .net 2003, It has Mobile Development with it.

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

  2. #2
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: OpenFileDialog and SaveFileDialog

    There are openfiledialog and savefiledialog controls for mobile devices in the VB.Net toolbox.

    What code did you try that didn't work?

    Pete

  3. #3

    Thread Starter
    Hyperactive Member FireKnox101's Avatar
    Join Date
    Aug 2005
    Location
    Snohomish,Washington
    Posts
    301

    Re: OpenFileDialog and SaveFileDialog

    heres the savedialog i used.

    VB Code:
    1. SaveFileDialog1.Filter = "Text files (*.txt)|*.txt"
    2.         SaveFileDialog1.ShowDialog()
    3.         If SaveFileDialog1.FileName <> "" Then
    4.             FileOpen(1, SaveFileDialog1.FileName, OpenMode.Output)
    5.             PrintLine(1, txtNote.Text)  'copy text to disk
    6.             FileClose(1)
    7.         End If

    and heres the opendialog i used.

    VB Code:
    1. Dim AllText, LineOfText As String
    2.         ofd.Filter = "Text files (*.txt)|*.txt;"
    3.         ofd.ShowDialog() 'display Open dialog box
    4.         If ofd.FileName <> "" Then
    5.             Try 'open file and trap any errors using handler
    6.                 FileOpen(1, ofd.FileName, OpenMode.Input)
    7.                 Do Until EOF(1) 'read lines from file
    8.                     LineOfText = LineInput(1)
    9.                     'add each line to the AllText variable
    10.                     AllText = AllText & LineOfText & vbCrLf
    11.                 Loop
    12.                 txtOutput.Text = AllText 'display file
    13.                 txtOutput.Select(1, 0)   'remove text selection
    14.                 txtOutput.Enabled = True 'allow text cursor
    15.                 MenuItem3.Enabled = False
    16.                 MenuItem4.Enabled = True
    17.             Catch
    18.                 MsgBox("Error opening file.")
    19.             Finally
    20.                 FileClose(1) 'close file
    21.             End Try
    22.         End If

    Im currently using: VB.NET 2003, And VB 2005 Express
    My Projects
    Form Them Show Keypress In App
    Simple Ping Control

  4. #4
    Frenzied Member
    Join Date
    Oct 2005
    Posts
    1,286

    Re: OpenFileDialog and SaveFileDialog

    Hi,
    where do you get the error, as the code below works fine

    VB Code:
    1. OpenFileDialog1.Filter = "Text files(*.txt)|*.txt"
    2.         OpenFileDialog1.ShowDialog()
    3.         MsgBox(OpenFileDialog1.FileName)
    4.  
    5.         SaveFileDialog1.Filter = "Text files(*.txt)|*.txt"
    6.         SaveFileDialog1.ShowDialog()
    7.         MsgBox(SaveFileDialog1.FileName)
    Pete

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