![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
|
|
#1 |
|
Programmer
Join Date: Feb 2005
Posts: 62
Rep Power: 4
![]() |
"open" dialog boxes
hello,
in a program i'm trying to write, i've got a certain part where the user clicks on a button that says "load list" and the program reads from an external text file in a hardcoded location and fills in a listbox based on the contents of that text file. i've got the reading/writing the external text file part down, but i would like to be able to allow the user to specify what text file they would like to open in the first place by clicking on "load list" as if it were a "browse for file" button. i know this is a very, very noob question concerning visual basic but most of my programming background comes from qbasic many years ago, and i never had to deal with forms, APIs or all that much graphical interaction back then ![]() i did find one site that provided code that explained how to do it, but it didn't work for me (i'm using VB6, i think it was geared towards .NET) and it was too complex for me to understand how to fix it. so if someone can summarize the basics of what i need to summon an "open" dialog box, i'd appreciate it. thanks edit: while i'm at it, once the user has found the file they want to load and loaded it, i've got another button labeled "edit list" for which i want to open the actual text file they specify in notepad. for the life of me i can't figure out how to actually open an external file. i've tried the shell and appactivate commands but neither seemed to work. Last edited by chepfaust; Feb 18th, 2005 at 2:01 PM. |
|
|
|
|
|
#2 |
|
Programming Guru
![]() ![]() |
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#3 |
|
Programmer
Join Date: Feb 2005
Posts: 62
Rep Power: 4
![]() |
score!
thanks much ![]() |
|
|
|
|
|
#4 |
|
Programming Guru
![]() ![]() |
no prolem man. msdn is a great resource for vb programming.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#5 |
|
Hobbyist Programmer
|
use a cmdb
__________________
And there was much rejoicing... Yay.... |
|
|
|
|
|
#6 |
|
Programmer
Join Date: Feb 2005
Posts: 62
Rep Power: 4
![]() |
ok cool so i got the hang of dialog boxes; it was as easy and simple as i thought it'd be.
however i still haven't figured out how to open an external file (need to open a specified notepad file at the push of a button), so if anybody has any pointers on that i'd appreciate it. thanks |
|
|
|
|
|
#7 |
|
Programmer
Join Date: Feb 2005
Posts: 62
Rep Power: 4
![]() |
new question concerning open dialog boxes-
when the user clicks on "cancel" in an "open" dialog box, is there any way to get a value from the user's action? for example my current problem is that in the dialog box, if the user clicks on a file but clicks on "cancel," the program will continue on as if the user clicked on the file and clicked "open." how do i stop this? thanks edit: actually i figured it out, i think. i've now manually set the commondialogOpen.filename to "" before initiating commondialogOpen.action = 1. i think the problem was that once i used the commondialog, the default filename carried over from the previous time i used the CDL, so my manual setting the filename to nothing would allow me to use a if cdlOpen.filename = "" statement to cancel out of the subroutine. Last edited by chepfaust; Mar 9th, 2005 at 1:15 AM. |
|
|
|
|
|
#8 |
|
Programming Guru
![]() ![]() |
I think that the Cancel button returns something like a 0 or something like that, i can't remember, since it's been a long time since i've done anything with VB.
__________________
Profanity is the one language that all programmers understand. Check out my Blog <---updated Nov 30 2007! |
|
|
|
|
|
#9 | |
|
Expert Programmer
|
Quote:
However, I'd recommend using the APIs themselver directly. They are much better, more flexible, and plus no one seems to have Comdlg in their system, meaning that unless you copy the ocx onto every computer, you'll get a fatal error. |
|
|
|
|
|
|
#10 | |
|
Programmer
Join Date: Feb 2005
Posts: 62
Rep Power: 4
![]() |
Quote:
my solution above worked with the "open" dialog boxes, but now i'm having the same problem with my "save" dialog boxes and i can't use my previous solution because the default filename is not consistant. |
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|