|
-
Sep 14th, 2003, 02:59 PM
#1
text editor: open dialog [resolved]
I'm really new to VB, I started about two weeks ago in a class at school, but here goes:
I'm using VB 6.0, and I'm making a text editor, and I have it working fine at this point. I use a drive selector, directory box, and file box to determine what files to open. I want to have you able to click on a button labelled "open" and it will pop open a browse window, and allow you to look around your computer for an appropriately labelled file type. I think you have to make a "CommonDialog" but I'm not sure how to make one, and I'm not sure if that's even what you have to make. I was looking through a post last night and found some stuff on ListBoxes and I took some of the code there to come to making this:
VB Code:
Private Sub menu_open_Click()
CommonDialog1.Filter = "PHP (*.PHP;*.PHP3;*.PHTML;*.TXT) | *.php;*.php3;*.phtml;*.txt"
CommonDialog1.CancelError = False
CommonDialog1.ShowOpen
End Sub
So, does anyone know how to make a CommonDialog? Or a better way of doing what I want to do?
Last edited by kows; Sep 14th, 2003 at 06:15 PM.
-
Sep 14th, 2003, 03:02 PM
#2
Lively Member
just search through your controls for "Microsoft Common Dialog Control" and paste it on your form anywhere (it is invisible during runtime), and that should work for you!

-morrowasted
-
Sep 14th, 2003, 03:18 PM
#3
I have no idea how to "search through my controls." I searched through the object browser for that and just plain "CommonDialog" and it couldn't find anything. I'm new to VB, so I don't really know that much about it except most of the basics, but I am a web programmer.
edit: nevermind, I figured out how to add the common dialog, but I get an error when I try to run the program. I selected the commondialog thing, pressed ok, and ran it and it gave me an "Object Required" error here (highlighted red):
VB Code:
Private Sub menu_open_Click()
[COLOR=red]CommonDialog1.Filter = "PHP + TXT (*.PHP;*.PHP3;*.PHTML;*.TXT) | *.php;*.php3;*.phtml;*.txt"[/COLOR]
CommonDialog1.CancelError = False
CommonDialog1.ShowOpen
commonFile = CommondDialog1.FileName
If Len(commonFile) > 0 Then
OpenFile txt_file, commonFile 'show file contents
lbl_filepath.Caption = commonFile 'show filepath
menu_close.Enabled = True 'enable close button
menu_save.Enabled = True 'enable save button
End If
End Sub
man, I'm such a VB newb..
Last edited by kows; Sep 14th, 2003 at 04:37 PM.
-
Sep 14th, 2003, 04:40 PM
#4
-
Sep 14th, 2003, 04:55 PM
#5
I went to Projects > Components and scrolled down to 'Microsoft Common Dialog Control 6.0' and pressed the checkbox next to it, and then hit OK. It doesn't show up as an object in my form, like under the drop down menus, so I have no idea if I actually added it.
Any help is appreciated..
-
Sep 14th, 2003, 05:13 PM
#6
-
Sep 14th, 2003, 06:15 PM
#7
ahh, cool, thanks then. How simple of a mistake that screwed me up, I never would of thought it would add into my tool box. Thanks again.
-
Sep 14th, 2003, 06:28 PM
#8
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
|