|
-
Aug 19th, 2000, 01:06 PM
#1
Thread Starter
New Member
i have a question on the commondialog conponent.....I need to know how to load a txt file that i pik from the commondialog into a richtextbox.....Please reply...Thanx Michael
-
Aug 19th, 2000, 01:11 PM
#2
Try this.
Code:
CommonDialog1.ShowOpen
RichTextBox1.LoadFile CommonDialog1.FileName, rtfText
-
Aug 19th, 2000, 01:14 PM
#3
The above example was short for simplicity sake. This next example is well commented and will handle errors (if cancel is selected).
Code:
On Error Resume Next
'Generate an error when cancel is pressed
CommonDialog1.CancelError = True
'Define the file-types
CommonDialog1.Filter = "Text Files (*.txt)|*.txt"
'Display the Open dialog
CommonDialog1.ShowOpen
'Make sure an error doesn't occur
If Err <> 32755 Then
'Loads the file. Change rtfText to rtfRTF if you want the file to
'be in RichText format
RichTextBox1.LoadFile CommonDialog1.filename, rtfText
End If
-
Aug 20th, 2000, 12:13 PM
#4
Thread Starter
New Member
Thanx
Thanx you two....I really appreciate it.
-
Aug 20th, 2000, 12:27 PM
#5
Thread Starter
New Member
One More Question
I need the code just like above but to save it...sorry so many questions..Thanx S.ystem
-
Aug 20th, 2000, 01:19 PM
#6
transcendental analytic
Yep, you just have to use showsave instead of showload, and savefile intead of loadfile
Code:
CommonDialog1.ShowSave
RichTextBox1.SaveFile CommonDialog1.filename, rtfText
Use  
writing software in C++ is like driving rivets into steel beam with a toothpick.
writing haskell makes your life easier:
reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|