Results 1 to 5 of 5

Thread: Opening Files into child window textbox

  1. #1

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985

    Opening Files into child window textbox

    I get this error
    Additional information: Invalid file format.
    I am using this code

    VB Code:
    1. If OpenFileDialog.ShowDialog() = DialogResult.OK Then
    2.             Dim Child As frmChild
    3.             Child = New frmChild
    4.             Child.MdiParent = Me
    5.             Child.Show()
    6.             Child.ActiveForm.Text = OpenFileDialog.FileName
    7.             Child.txtBoxChild.LoadFile(OpenFileDialog.FileName)
    8.         End If

    What's wrong?

  2. #2
    Fanatic Member robbedaya's Avatar
    Join Date
    Jul 2002
    Location
    Belgium
    Posts
    872
    what fileformat are you trying to open inth textbox. I understand you try to open a format that is not supported
    - Use the thread tools to Mark your Thread as Resolved when your question is answered.
    - Please Rate my answers if they where helpful.

  3. #3

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Originally posted by robbedaya
    what fileformat are you trying to open inth textbox. I understand you try to open a format that is not supported
    I'm just trying to open a plain ole text file into a rich text box...

  4. #4
    Frenzied Member dynamic_sysop's Avatar
    Join Date
    Jun 2003
    Location
    Ashby, Leicestershire.
    Posts
    1,142
    you are missing a vital bit in the LoadFile of the richtextbox :
    VB Code:
    1. Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    2.         Dim od As New OpenFileDialog()
    3.         od.InitialDirectory = "C:\"
    4.         If od.ShowDialog = DialogResult.OK Then
    5.             RichTextBox1.LoadFile(od.FileName, RichTextBoxStreamType.PlainText)
    6.         End If
    7.     End Sub

    RichTextBoxStreamType.PlainText
    ^^^ being the bit.
    ~
    if a post is resolved, please mark it as [Resolved]
    protected string get_Signature(){return Censored;}
    [vbcode][php] please use code tags when posting any code [/php][/vbcode]

  5. #5

    Thread Starter
    KrisSiegel.com Kasracer's Avatar
    Join Date
    Jul 2003
    Location
    USA, Maryland
    Posts
    4,985
    Thanks, that works

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