RichTextBox issue

  • Thread starter Thread starter Bob
  • Start date Start date
B

Bob

If one drops a file, say a text file onto a richtextbox, the file name does
not appear, only the file type.
Is there a setting I'm missing or is it just a richtextbox thing?

thanks
Bob
 
David,
There is not much to post, I drop the RTB onto a form, set the
"EnableAutoDragDrop" to true. I added a few lines to write to a file.
Interestingly, if you open the created myfile.rtf with wordpad, it also
shows no file names BUT if you create the myfile.rtf with wordpad, drag
files into it, then open with the following code, the file names are shown!
Dumbfounded,
Bob

Public Class Form1
Private Sub ReadButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles ReadButton.Click
Try
RichTextBox1.LoadFile("c:\myfile.rtf")
Catch ex As Exception
Beep()
End Try
End Sub

Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles SaveButton.Click
Try
RichTextBox1.SaveFile("c:\myfile.rtf")
Catch ex As Exception
Beep()
End Try
End Sub
End Class


dotNetDave said:
Can you please post your code? It sounds like you are not calling your
object
correctly.

David


======================================
David McCarter [Microsoft MVP]
www.dotNetTips.com
David McCarter''s .NET Coding Standards available at:
http://codingstandards.notlong.com


Bob said:
If one drops a file, say a text file onto a richtextbox, the file name
does
not appear, only the file type.
Is there a setting I'm missing or is it just a richtextbox thing?

thanks
Bob
 
Back
Top