Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    Visual Basic




Opening A Txt File From My Program Using Common Dialog


this is what i have in a bas:

Public Sub Save_File(Contents As String)
On Error GoTo ErrHandle:
Dim FileName As String, lFile As String
Dim NewDate As String

' Filter:
frm_main.CommonDialog1.Filter = "Text Files (*.info)|*.info2"

' Default Directory:
frm_main.CommonDialog1.InitDir = App.Path

' What is the "Default" Filename: Use the whole path:
frm_main.CommonDialog1.FileName = App.Path & "untitled1.info"
'Ask to overwrite if it already exsists
frm_main.CommonDialog1.flags = &H2
' Show the save box
frm_main.CommonDialog1.ShowSave
' The Filename is what the user entered
FileName = frm_main.CommonDialog1.FileName
' if the filename contains something, save the file
If Len(FileName) > 0 Then
lFile = FreeFile
Open FileName For Output As #lFile
Print #lFile, Contents
Close #lFile
End If
Exit Sub

ErrHandle:
If Err.Number = "32755" Then
'It's a Cancel Error, Just Ignore it
Else
MsgBox "Error: " & Err.Description, vbOKOnly, "Error # " & Err.Number
Err.Clear
End If
End Sub
---------------------------

i only have the save option, i need the open option, could any one make it so i can add it to the module?




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Common Dialog For Opening A File But...
I want to have the Open File Common Dialog but i dont want it to open a file. I just want to save the path and file name of the file opened to a string. Is that possible.

If its not possible how would i go upon making a browse input box kind of thing to browse for a file and save the full path as a string?

Thanks for you help in advance.

Opening A File Using Common Dialog Or Other Method?
Hello,

Have a small problem that I was hoping someone could help me out with.

I need a way (GUI) to select specific files in a single directory. The catch is that I cannot allow the user to browse the directories on the drive. The problem is, the files that need to be selected all change and at any one time the user needs to see all of the files contained in that directory before selecting the file.

For instance.....a user comes along and presses a button to open a file through some GUI based form (similar to the Common Dialog Box). All of the files are listed to choose from, but they MUST not be able to "browse" from that location. After the file is selected, processing code then occurs until the user presses the open file box button again and then this repeats.

I have been able to use the "Common Dialog Box" which provides the nice GUI interface and using the ".initDir" option I can default to the correct directory to select a file each time, but the CDB does not appear to have an option for disallowing the browsing of directories.

I guess my other option is using the "FileListBox" object but wanted some other experts to give their opinion on what might be the best method before I spend more time looking at different alternatives.

Thanks.

Opening Specific File Using Common Dialog
How do I open a specific file (an access db) using the common dialog function?  I presume it needs to be automatically displayed in the file name of the open file box.

Also I want to be able to either open it at the beginning of the file or create new record by opening at the end of the file.  I have created a menu with new and open for this purpose but can't find the code I need.

Thanks for looking

Opening Position Of Common Dialog File Form.
Quote:





Originally Posted by Dutch-O


Thanks a lot both of you.




Hi, Dutch-0.

It looks like you have used the vb Common Dialogue. I downloaded the attached Common Dialog module in this thread. I also printed out some instructions from the instructions for using the common dailogue. I have been unable to make the module to work in my form. The common dialog is loaded, but I have been unable to get the codes to get filename to open (one example). Could you help me out by posting one of your codes in getting filename to open (in your form)? If I can get this common dialog to work, I don't want to use Comdlg32.ocx.

Thank you.

MydanVue

Opening Position Of Common Dialog File Form.
Hi,

I use the common dialog form for files. It oppens in the top left corner. I can't find the handles to make it appear/open in the middle of the screen. It has to be simple but couldn't find it.

Thanks

Opening A Text File From Common Dialog With A Text Box.
Could someone tell me why I get
'Variable Required - cant assign to this expression'
when I try to use this code from a command button.

Private Sub Command1_Click()
With CommonDialog
.ShowOpen
.Filter = "Text File|*.txt|"
End With
Open CommonDialog.filename For Input As #1
Do Until EOF(1) = True
Get #1, , Text1
Loop
Close #1
End Sub

?????

Opening A Folder Using A Common Dialog.
Ok how do i open a folder using a common dialog. So for example the filename for files vary within many folders that appear in one single folder.

e.g. C:WINDOWSDesktopMy ProjectsCalculator etc. The filename i want the common dialog to display in a label is C:WINDOWSDesktopMy Projects. Is this possible and how would i go about doing it.

Thank you

Opening As Read Only With Common Dialog
I'm having problems having my program detect whether the "Open as Read Only" option was checked or not.

<code up here to show the open file dialogue and to read the file's contents>

If Dialog.Flags = cdlOFNReadOnly Then
Debug.Print "read only"
strLoadedFile = ""
End If

My Common Dialog Control is named "Dialog" but that code is obviously incorrect because it didn't work ;o

My apologies if this should go to a different forum. I wasn't sure if I should post here or the general forum. Any help would be greatly appreciated; I've been trying to find the answer to this or an example of this, but I didn't find anything in google--they all just set the Flag as cdlOFNHideReadOnly and avoided the situation entirely.

I did do this before showing the open dialog though:
Dialog.Flags = cdlOFNLongNames Or cdlOFNFileMustExist

Is that what's making it not work?

Opening And Positioning A Color Common Dialog
This is a Win32 example of opening a Color Common Dialog without use of the VB control. You may positioning the control where desired, or simply center it on the screen.

Enjoy!

Common Dialog Stops My Program
hi ppl. have a little trouble here
when i show a common dialog to select font or file, program stops until user close dialog. BUT program receive data via socket and dont execute dataarrival event;

How i can show common dialogs AND make program running without stops or pause waiting for user action?

Common Dialog Box In VB Program Running On Vista
I have noticed that one of our vb 6.0 apps will not run on vista. You double click the exe and it starts and stops just as quickly without ever displaying the form that the code is supposed to display.

I installed visual studio 6.0 brought the code over to vista. Expecting to see an error in code, it worked without any errors. Compiled it again on vista and ran it compiled and nothing. The program just stops, and the form is never displayed.

More confused than ever I looked at the form it was trying to load. The only thing special about it was that it had a control on it. (Microsoft Common Dialog 6.0) Took this control off the project recompiled again and tried running it compiled and it WORKED!

So now my question is how do I get around this I need to be able to have a file dialog box to allow the user to browse for a file.

Anybody have any ideas? Thanks!

Lisa

Common Dialog Box Cancel Button To Close Program
I'm using a common dialog box, to grab the path of a file to open. But if the user clicks cancel i want the program to close. How do i do this?

Common Dialog - It Seems To Make My Program Run A Little Bit Slower - Is This Normal?
When I inserted the common dialog control into my project, it seems to make the program run a little bit slower, is this normal?
Any tips on how to fix it?
Thanks!
Eric

Common Dialog Control: How To Show A "replace File" Dialog Before Save
Its saving Ok, but i need it to ask the user if he wants to
replace the file when it has the same name.
It should occur just the first time, and then the following clicks
on save shoudnt ask again.

How can I do it?

Thanks!
JCI

File New Common Dialog
I've seen in an application a common dialog box very similar with the Save File Common Dialog Box, but instead of the Save button it had Create button.
I want to create something similar in my app. I assume it is a parameter that I have to rename in my Common Dialog box and then call .ShowSave.
How can I rename that Button to "Create"?

Common Dialog File Name
I really hate to ask this question, but I have been searchng the form for like almost an hour and can't find the answer.

When I use commondialog1.filename it gives the full path. is there a way to justget the file name?


Thanks so much.

-Robert

Parse Common Dialog File
Hi,
I have a Multiselect Common dialog and I want to parse the filenames.. how do I do that ??
The filenames are separated by Nulls !!

Pls help me

-Ln

Why Does Common Dialog Generate A *.cfn File?
Every time I open a file with Common dialog, a *.cfn file is generated in the same folder the project/executable lives in. The *.cfn file is just text with the follwing, "\filepathfilename
ame of executable.dft" Why is this happening?

Thanks

Common Dialog - Open File
Is there a way where you can load .rtf .doc into a textbox? not a richtextbox?

Edit by Moderator: In the future, please start your own threads, don't dig up 2 year old threads. Thanks.

Common Dialog - Open File
Hi guys,

would somebody PLEASE tell me why this code will not open a file. I read MikeJ's tutorial and I couldn't get it to work because I don't have a Rich textbox. Why do I need one? I'm trying to open any form from a File/Open menu. When I select the file, it goes into the window on the open dialog box but it just will not open. I've been step by step through two books and this forum for 3 hours with no luck. PLEASE HELP.

Thanks.


[vb]


Private Sub FileOpen_Click()

CommonDialog1.Filter = "Text Files (*.txt)|*.txt|All Files (*.*)|*.*" 'This sets the filter for common dialog

CommonDialog1.ShowOpen 'Make common dialog show the open dialog

Open CommonDialog1.FileName For Input As #1


End Sub

[VB]

Save File With Common Dialog
How can i save a textbox with a common dialog so i can go the the place i want to save my file all i got so far is

CD1 = shot for CommonDialog1

Private Sub Command5_Click()
CD1.ShowSave
End Sub

Get File Names From MS Common Dialog
Hello-
I have used a Microsoft Common Dialog 6.0 control in my Visual Basic project with multi-select set to true. Now I need to call each file that was selected into a string that is being written to a text file. Each file name will be a new line in the text file. Not sure, but I think I need to use a Do/Loop to build this list of files. I used the "Open" method to open a file then the "Output" method to write to the file. The best method I can see to use is "Write" to amke the output to the file. But I am not sure how to iterate over the selcted files writing a new line for each file. Any help is greatly appreciated. Thank you.

Open File Without Common Dialog
How can I have a open file dialog without using the common dialog within VB6? I do not want to create a new form and open it, I want a real open file dialog.

How can I do this?

Save A File Without A Common Dialog?
I want to save a file to c:examplewebpage.html on button click without a commondialog box.

How can I get it to automatically save?

Common Dialog Predetermined File ?
hi , im taking a look at a file sender made by someone else , and they used common dialog to search for files to send , is there a way to illiminate this process and have a predetermined a file to send

im trying to make a small game that involves file sending back and forth , and would like to assign a command button for each of these predermined files within the game

so say the the file locations would be:

C:Program FilesOpForAnimations1

C:Program FilesOpForAnimations2

C:Program FilesOpForAnimations3

C:Program FilesOpForAnimations4

instead of using common dialog to find them , id like to have something easier like

Private Sub Command1_Click()
send file C:Program FilesOpForAnimations1
End Sub

im such a noob , and im sorry for that , i just want a predetermined location rather than using common dialog manually if thats possible

Common Dialog And File Extensions
I cannot figure out how to make the common dialog use the file extension filters. Does anyone know how to do this?

Common Dialog File (comdlg32.ocx)
Is there a version of Microsoft's Common Dialog (developed circa 1995) that will work with both VB 5 and 6?

Common Dialog And File Type
is there a way i can configure the common dialog to restrict the types of files. for example, i only need .txt files, only txt files will be shown instead of all.

Input A File From A Common Dialog Box
I am trying to Input a file from a common Dialog box but I am not sure of the code up to a certain point. Here is my code:


option Explicit

private Sub cmdEndprogram_Click()
Dim intResponse as Integer
Const conPrompt as string = "Are you sure?"
Const conTitle as string = "Quit?"
intResponse = MsgBox(conPrompt, vbYesNo + vbQuestion, conTitle)
If intResponse = vbYes then
Unload me

End If
End Sub

private Sub Form_Load()
Dim problemNumber as Integer, name as string
Dim title1 as string, problemNumber1 as Integer
Dim prompt as string, title as string, question as string
Dim answer1 as string, answer2 as string
Dim answer3 as string, number as Integer
Dim leftPos as Integer, buttonWidth as Integer
Dim ControlArray as Integer, intFileNum as Integer
Dim FileName as string
frmSplash.Show vbModal
prompt = "Enter your Name."
title = "Your Name"
name = InputBox(prompt, title)
'CommonDialog1.ShowOpen
cdlOpenfile.ShowOpen

'pen "DataType Quiz.txt" for input as 1
'input #1, title1, problemNumber1
'print #2, name
'print #2, title1, problemNumber1
'get the size and position of the first button.
'leftPos = cmdDisplay(0).Left
'buttonWidth = cmdDisplay(0).Width

'Do While Not EOF(1)
'input #1, problemNumber, question, answer1, answer2, answer3, number
'picOutput.print problemNumber, question
'print #2, problemNumber, question, answer1, answer2, answer3, number


'Loop
'for ControlArray = 1 to problemNumber
'Load cmdDisplay(ControlArray)
'leftPos = leftPos + buttonWidth + 30
'cmdDisplay(ControlArray).Left = leftPos
'cmdDisplay(ControlArray).Caption = ControlArray
'cmdDisplay(ControlArray).Visible = true
'next ControlArray
'Close 1
'Close 2
End Sub




Here is the file I am trying to input. I have two other files that I have to input as well, so I have to have a control array for each question so I have a command button for each question. I guess I am just asking for a example on how I input the text file from the common dialog box into the text window, one question at a time and the control array for a button for each question.


Data-types Quiz, 8
1, What data-type would you use for the population of Chicago?, LONG,LONG,lng,1
2, What data-type would you use for a Social Security number?, STRING,STRING,str,1
3, What data-type would you use for a variable where the only valid values are ON/OFF?, BOOLEAN,BOOLEAN,bln,1
4, What data-type would you use for a constant with a value for Pi?, SINGLE,SINGLE,sng,1
5, What data-type would you use for a variable to hold the grains of sand on a beach?, DOUBLE,DOUBLE,dbl,1
6, "What initial should proceed a Public variable in a module to indicate its scope?
a. p
b. g
c. m
d. No initial", B,G,"B. g",5
7, "What initial should proceed a variable that is used in a form to indicate its scope?
a. p
b. g
c. m
d. No initial", C,M,"C. M",5
8, "What initial should proceed a variable that is used in a local procedure to indicate its scope?
a. p
b. g
c. m
d. No initial", D,NO INITIAL,"D. NO INITIAL",5

Common Dialog File Select Not Containing File Names.
hi,
i have this vb script code that i'm using in a .hta program. it basically calls a common dialog to display multiselect file list using explorer type file list.
here's the code:

Code:
Set ObjFSO = CreateObject("UserAccounts.CommonDialog")
ObjFSO.Filter = "All Files|*.*"
ObjFSO.FilterIndex = 3
ObjFSO.InitialDir = "c:"
ObjFSO.Flags = cdlOFNAllowMultiselect or cdlOFNExplorer
InitFSO = ObjFSO.ShowOpen
selected_files = ObjFso.FileName
each_file = split(selected_files, vbnullchar)
everywhere i look at, they state that if you use this code, it should contain all the file names that you selected. but i only see the path. no file names. however if i only select one file, it will display the path and file name.
any ideas, how i can get the selected file names to show up?

Common Dialog Control To Select File The File To Use
As I am newbie at VB6 I woudl like some help on how to implement a common dialog control on my form so I can select the txt file I wish to use to bring into my array. Sorry It seems like such simple question but I would really appreciate some guidance on this? Thanks!

Input File From A Common Dialog Control
this is the code in my form:

Private Sub mnuOpen_Click()
cdlNewEmployee.Filter = "Employee Data (*.dat)|*.dat|All Files (*.*)|*.*"
cdlNewEmployee.Flags = cdlOFNHideReadOnly
cdlNewEmployee.ShowOpen
cdlNewEmployee.CancelError = False
cdlNewEmployee.FileName = ""
Call modEmployee.OpenFile
End Sub

this is the code in my module:

Public Function OpenFile()
Dim lastName As String, firstName As String, _
age As Integer, sexMale As Boolean, count As Integer

Do While EOF(1) = False
Open "EMP.DAT" For Input As #1
Input #1, lastName, firstName, age, sexMale
Call modEmployee.AddNewEmployee(lastName, firstName, age, sexMale)
Close #1
Loop

End Function

when i click on the "EMP.DAT" file to be opened, a run-time error occurs saying: "bad file name or number." and it highlights the "Do While EOF(1) = False" section of my code.

what am i doing wrong?

this is the rest of the module:
Option Explicit

' A type to store an employee record
Public Type EmployeeRecord
lastName As String
firstName As String
age As Integer
sexMale As Boolean
End Type

Dim empList() As EmployeeRecord ' the employee list
Dim numEmployees As Integer ' number of employees in the list
'Dim cdlNewEmployee As CommonDialog

Public Function GetEmployee(ByVal index As Integer) As EmployeeRecord
GetEmployee = empList(index)
End Function

Public Function GetNumEmployees() As Integer
GetNumEmployees = numEmployees
End Function

Public Sub ClearEmployeeList()
' Clear the array.
numEmployees = 0
ReDim empList(numEmployees) As EmployeeRecord
End Sub

Public Sub AddNewEmployee(ByVal ln As String, _
ByVal fn As String, _
ByVal age As Integer, _
ByVal male As Boolean)
' Add a new employee record to the array.
ReDim Preserve empList(numEmployees) As EmployeeRecord
empList(numEmployees).lastName = ln
empList(numEmployees).firstName = fn
empList(numEmployees).age = age
empList(numEmployees).sexMale = male
numEmployees = numEmployees + 1
End Sub

Public Function GenderCount(ByVal male As Boolean) As Integer
' Count the # of males/females.
Dim i As Integer
GenderCount = 0
For i = 0 To numEmployees - 1
If empList(i).sexMale = male Then
GenderCount = GenderCount + 1
End If
Next i
End Function

Public Function FormatNames(ByVal lastName As String, ByVal firstName As String) As String
' Format the given last name and first name to
' the format "LASTNAME, firstname".
FormatNames = UCase(lastName) & ", " & firstName
End Function

this is the rest of the form:
Private Sub Form_Load()
' Initialize the array.
Call modEmployee.ClearEmployeeList
mnuSave.Enabled = False
End Sub

Private Sub cmdQuit_Click()
' Terminate the program.
End
End Sub

Private Sub cmdMale_Click()
' Count # of males.
Call MsgBox("Number of males: " & modEmployee.GenderCount(True), vbInformation)
End Sub

Private Sub cmdFemale_Click()
' Count # of females
Call MsgBox("Number of females: " & modEmployee.GenderCount(False), vbInformation)
End Sub

Private Sub cmdAdd_Click()
' Display a dialog box for adding a new employee
frmEmployee.Show vbModal, Me
If frmEmployee.gValidInfo Then
Call modEmployee.AddNewEmployee(frmEmployee.gLastName, _
frmEmployee.gFirstName, _
frmEmployee.gAge, _
frmEmployee.gSexMale)
Call UpdateList
End If
mnuSave.Enabled = True
End Sub

Private Sub cmdClear_Click()
' Clear the array.
Call modEmployee.ClearEmployeeList
Call UpdateList
End Sub

Private Sub lstEList_Click()
' An item is selected. Retrieve employee record from list
' display data in text boxes.
Dim emp As EmployeeRecord
emp = modEmployee.GetEmployee(lstEList.ListIndex)
txtAge = emp.age
If emp.sexMale Then
txtSex = "Male"
Else
txtSex = "Female"
End If
End Sub

Private Sub lstEList_LostFocus()
' Clear the text boxes
txtAge = ""
txtSex = ""
End Sub

Private Sub UpdateList()
' Populate the information from the array to the list box.
Dim i As Integer, nEmployees As Integer, str As String
lstEList.Clear

nEmployees = modEmployee.GetNumEmployees()
For i = 0 To nEmployees - 1
str = modEmployee.FormatNames(modEmployee.GetEmployee(i).lastName, _
modEmployee.GetEmployee(i).firstName)
lstEList.AddItem str
Next i
End Sub

and this is the other form:
Option Explicit

Public gValidInfo As Boolean
Public gLastName As String
Public gFirstName As String
Public gAge As Integer
Public gSexMale As Boolean

Private Sub Form_Load()
gValidInfo = False
gLastName = ""
gFirstName = ""
gAge = 0
gSexMale = True
End Sub

Private Sub cmdCancel_Click()
' Close this dialog box.
Unload Me
End Sub

Private Sub cmdOK_Click()
' Validate input and populate the information to the form variables.
If txtFirstName = "" Then
Call MsgBox("First name cannot be empty.", vbExclamation)
txtFirstName.SetFocus
Exit Sub
End If

If txtLastName = "" Then
Call MsgBox("Last name cannot be empty.", vbExclamation)
txtLastName.SetFocus
Exit Sub
End If

If txtAge = "" Then
Call MsgBox("Age cannot be empty.", vbExclamation)
txtAge.SetFocus
Exit Sub
End If

gLastName = txtLastName
gFirstName = txtFirstName
gAge = Val(txtAge)
gSexMale = optMale
gValidInfo = True
Unload Me
End Sub

Extending Common Dialog File Open
In XP when applying the cdlOFNExplorer flag I get the XP style File Open Explorer. Does anyone know of a way to send this dialog a message, or is there a Windows API that will allow me to extend the list of folders that appear on the left (currently it shows the standard My Computer, My Documents, etc). I would like to add a couple of my own - and even eliminate some of the existing ones that don't fit my application metaphor...
Ideas?
VB6 preferably - but .net is fine.

Common Dialog - Multiple File Selection
Hi all!

Does anyone know what the heck I am missing here?

Code:
cdl1.FileName = ""
cdl1.Flags = cdlOFNAllowMultiselect Or cdlOFNExplorer
cdl1.ShowOpen
Text1 = cdl1.FileName
I am just trying to get the names of multiple files using the common dialog control. When I run the code, the "Text1" field displays the path from which the files were seleced, but nothing else. However, when I pause the code and hover over the ".FileName" in the last line of code, the popup help thing-a-ma-jig displays the filenames also (what I need in to be placed in the textbox!) seperated by a square or box (I believe this is the value for a null character.

I've searched and searched, and repeatedly find that this is correct and should be working!!! Does anyone else NOT get the same results as I do?

Thanks!

How To Let Common Dialog Check Existing File?
I am using code to save a file:

commondialog1.ShowSave
Open commondialog1.FileName For Output As #1
Write #1, "abcd"
Close #1

But the commondialog1 never ask me whether that file is already existed, just directly replace the old one, how could I let it pop up the very useful msgbox to ask " the file is already existed, would you like to replace it?", thx for any help.

Also what should I set my code if the user click Cancel button on the commondialog1 (how could I know)?

yanli

Sort File By Date In Common Dialog Box
Hello,
When I display file names with the cmdialog control, I 'd like to see them sorted by date, to avoid clicking on the Date header.
How can I do that?
Regards,
aprx

Open File Error With Common Dialog
Hi,

I have an open file button, which uses the common dialog control...

The problem is, is that the program errors if the cancel button is selected.

Please help me eliminate this annoying error?


Here is the code;

Private Sub cmdopen_Click()
Dim customer As onecustomer
CommonDialog1.ShowOpen
txtfilename.Text = CommonDialog1.filename
filename = txtfilename.Text
Open filename For Random As #1 Len = Len(customer)
numberofrecords = LOF(1) / Len(customer)
num.Caption = numberofrecords
Close #1
End Sub


thankyou,
Mark

[Resovled]Common Dialog File Name To Textbox.
I want it so when you press a command button It opens a common dialog,(I've put the control in already) That you select a .bmp and go open and it just puts the name of the bmp into a textbox.....(With or Without the extension, it doesn't matter)
Can this be done
If you dont understand, post back

Common Dialog Control To Save A File.
Hi everyone,

I have a Command button "Attach" and a listbox "lstAttachments".
When a click the "Attach" Command button, I want to open the save common dialog control, select an existing file and if nedded, save this file in a different directory and include the entire directory and file name in the "lstAttchments". Ideally I will also like to click on the link in the " lstAttchments" and open the file from there.

So far I have the following code and it is not ready working well apart from opening the save common dialog.

Can you please help? First for me on this and have no idea how to progress.

Private Sub cmdAttach_Click()
Dim Filename As String
'Me.cmdAttach.SetFocus
CommonDialog1.Flags = cdlOFNHideReadOnly
CommonDialog1.Filter = "All Files (*.*)|*.*|Word Document" & _
"(*.doc)|*.doc|Text Files (*.txt)|*.txt"
'CommonDialog1.FilterIndex = 2
CommonDialog1.Filename = Filename
CommonDialog1.CancelError = True
CommonDialog1.ShowSave


lstAttachment.AddItem CommonDialog1.Filename

End Sub


Thank you.

dfuas

Common Dialog Box Won't Close Until File Done Reading
I am having a problem with VB6 in which a Common Dialog Box won't close until after a file has finished being read.

The user selects a file to read into an array using a Common Dialog Box and they choose "open". Instead of immediately shutting down the Common Dialog Box will stay open until after the file is read.

Visual Basic 6 seems to give priority to file operations and won't give the Common Dialog Box a chance to shut down before moving on and reading the file. Since the file I am trying to read is rather large the program just sits there with the Common Dialog Box open until it is done reading. The user of the program will think it has crashed.

I have also tried creating a progress bar but the Common Dialog Box stays open regardless.

Any suggestions? Thanks in advance.

Common Dialog Controll File Path
i was wondering how i can access the file path to a file selected for opening wiht a common dialog box. say i open a file called TextFile.txt in the directory C:Text Files, when i look at commondialog1.filetitle, it only shows TextFile.txt, and what i need also is the directory it came from, any help?

Save Excel File Using Common Dialog Box
Hi all

I am trying to save the Excel file that I created with data using Common Dialog box. After I created the file the messagex box pops up with two options "Save As" and "View". So I would like be able to save the file when the user clicks "Save As". So the "Save As" dialog will pop up and then I can choose the destination and save the file. After this all books will be closed. If tthe user click To view the file, I would like to load my file with data in to excel.

Please help me with this one

thank you

Getting The File Path Out Of A Common Dialog Box (Resolved)
Hello,

I've been trying to find a way of populating the URL of my hyperlink control with the file path to documents on my computer. Someone has kindly told me that I need to use a Common dialog box but I have no idea of the code I should use toget the file path out of the box when the user clicks 'OK'.

Does anyone have any suggestions?

Thanks

Sam

Choosing A Folder But Not A File With Common Dialog
Hi team

I want my users to be able to choose or create a folder with a common dialog. What they will do is select a folder that will become the default folder for a certain process. The common dialog showopen allows me to choose or create a folder, but it won't do anything until a file in that folder is selected. I my case, there won't be file there as it's only the folder that I want.

So how can I choose the folder and store it's path when there is no file in it?

FW

Common Dialog Box To Read Random File
Hey Im stuck. I have to write a program that will read in files using a common dialog box, However I am getting a mismatch error. I have included the code of what I have so Far and what I have in the project. Maybe I am entering the data wrong into the folder i am reading

Jones ,Jason ,7166275519,T
Pope ,Jose ,7165854519,T

This is how the data looks in the direcotry folder in the temp file

Here is the code and the program of what i have so far.

Private Type udtLookup
strLast As String * 20
strfirst As String * 10
strnumbers As String * 10
strDeletecode As String * 1 'F= False; T = True
End Type

Dim mudtLookup As udtLookup


Private Sub cmdexit_Click()
End
End Sub

Private Sub ReadFileIntoList()

dlgcommon.ShowOpen
Open dlgcommon.FileName For Random As #1 Len = Len(mudtLookup)
Do Until EOF(1)
Get #1, mudtLookup.strLast & mudtLookup.strfirst & mudtLookup.strnumbers, mudtLookup
lstdata.AddItem mudtLookup.strLast & "," & mudtLookup.strfirst & "," & mudtLookup.strnumbers
Close #1
Loop



End Sub


Private Sub Form_Load()

ReadFileIntoList

End Sub

Private Sub mnuExit_Click()
End
End Sub

Printing A File Using Common Dialog Control
I want the user to be able to use the properties the control has to offer to print a file. Let's say the user wants to print in landscape, how do i program the control to print the file in that way or whatever way the user choose along with any other options selected?

Printing A Text File Using Common Dialog
Here's another question concerning the common dialog control. How do you print text files with it? i tried to do it myself but i got stuck! please help me. thanks in advance.

ps after this post ill stop spamming about common dialog

Saving A Text File With Common Dialog
I'm making a text editor and it will be complete if i get the source code for saving a text file using the common dialog. can anyone help? this is like the last post where i asked how to open it . thanks in advance

Open A Text File With Common Dialog
how do you open a text file with the common dialog control? and how do you display it on a text box? im a newb to the common dialog control.

Copyright © 2005-08 www.BigResource.com, All rights reserved