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




Refresh Drive, Dir And File Controls


I have developed an app that uses the drive, dir and file controls so that I can read what is on a CD through the drive. I need some help to get my program to refresh automatically [like windows automatically does in explorer] so that when I insert a different CD, it is not necessary to have the user do anything. i.e. the program automatically reads the CD in the drive and updates the drive, dir and file controls.

Thanks.
jb




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Getting Full Directory And Drive Paths With The Drive/directory/file Controls
when i have a text editing program i wish the user to allow the user to find the file with other means than a common dialog box, i want to use drive/folder/file controls, but i dunno how to get the full path of the file... any suggestions?

After Using (Drive,Dir,File) Controls, How To Display Selected File Contents?
Hi, I have figured out how to take the following controls (Drive,Dir,File), place'em each in form then use DriveListBox to select a drive, from there use DirListBox and select a folder, from there go to FileListBox and select a file from that folder ... finally pressing a command button (cmdDisplayPathName) to display the complete pathname in (picDisplayPathName). All work fine. Here's what I want to do next:

Press another command button (cmdDisplayFileContents) to display the selected files' contents into a textbox (txtDisplayFileContents).

My code so far:
Code:
Private Sub DriveListBox_Change()
'This is the Drive List Box control
DirectoryListBox.Path = DriveListBox.Drive
End Sub


Private Sub DirectoryListBox_Change()
'This is the Directory List Box control
FileListBox.Path = DirectoryListBox.Path
End Sub


Private Sub FileListBox_Click()
'This is the File List Box control
End Sub


Private Sub cmdDisplayPathName_Click()
'When button is pressed, complete path displays
picDisplayPathName.Cls
picDisplayPathName.Print DirectoryListBox.Path;
If Right(DirectoryListBox.Path, 1) <> "" Then
picDisplayPathName.Print "";
End If
picDisplayPathName.Print FileListBox.FileName
End Sub


Private Sub picDisplayPathName_Click()
'Displays the complete pathname of selected file.
End Sub


Private Sub cmdDisplayFileContents_Click()
'When this button is pressed, the selected files' contents display into "txtDisplayFileCont.text"
** This is where I do not know how to code, tried a couple hokey ways, was totally incorrect.
** Need help in this area.
...........
Else
'Error message
MsgBox "Unable to display contents."
End If
End Sub


Private Sub txtDisplayFileContents_Change()
'Displays the contents of selected file.
End Sub
Three Questions

(1) What do I code in the 'cmdDisplayFileContents_Click()' portion in the above code?

(2) Once coded I know displaying a textfile is easy and will show up in textbox (txtDisplayFileContents), but what about other file types? Does a viewer of some sort need to be used to show file contents if not a straight text file? --- If so, how is this coded/implemented?

(3) In using (Drive,Dir,File) to browse around and select a file, I end up with three separate controls on the form ... is there now a shortcut (one control?) somewhere that can do the same thing? If so, what is it?

Thank you for any help and direction(s).
~ Juanita

How To Refresh A Map Network Drive
Normally, whe assign or map a Letter like F, G, H .... to a path in the network like \serverc, but in Win Xp some times the map to the path lost the connection and then I nedd to make double click in that map letter in the windows esxplorer to recover te connection
Rather and I want to know how to refresh automatically the map link using VB. Or How to verify the conection to the map is really connected and if not, connect it.

Thanks for your help

Luis

How Do I Get Drive ListBox Control To Refresh When New Device Added?
I have a drive listbox control, call it Drive1. I want to auto-detect if a thumb drive has been newly connected/disconnected.

I have tried every method provided for the drive listbox. It appears that when you click on it, it gets focus...then no other conditions fire regardless of where you click on the control (unless you change the selection, then you get a change event).

Right now, I have to have the user click away then click back, which is workable, but not preferable.
[ I'm doing a drive1.refresh in drive1_validate, form1_load and form1_mousedown]

Is there a simple solution that I'm not seeing?

-MagicT

Map Drive, Rename File, Copy File &amp; Disconnect Drive
Any one of u know how to solve below task using VB or other programming language?
First, map network drive(s), rename the filename (abc.exe) to abcYYYYMMDD.exe. Then, copy the latest version of exe file to the mapped drive. Finally, disconnect all mapped drive(s).
(i tried to use DOS command, but a lot of part need hard coding, and i dunno how to use looping in DOS)

Thanks in advance.

Could Not Refresh Controls Error
My program stops when it reaches this line...

MSRDC1.refresh

Vb error to say that it could not refresh controls.
What am i doing wrong?


VB Code:
Private Sub CmdSave_Click()Status = "Saving job"'  Now to save AWB details for later use   If awb <> "" Then            strsql = "select * from awb where awbill = '" & awb & "'"      MSRDC1.sql = strsql      MSRDC1.LockType = rdConcurLock       MSRDC1.Refresh       With MSRDC1.Resultset      If Not MSRDC1.Resultset.EOF Then        .Edit        entrydate = !entrydate      Else        .AddNew        entrydate = Date      End If      calc_special_fields                    !Shortcode = combo_senders_code           !Name = senders_name           !phone = senders_phone           !Company = senders_co           !Address1 = senders_addr1           !Address2 = senders_addr2           !City = senders_city           !state = senders_state           !Country = senders_cntry               CmdSend.Enabled = True End Sub

Refresh Excel Form Controls Value
THE CASE: I have developed 3 entry forms using EXCEL; Form1 show the different possibily; filling Form2 controls I enter Form 3; Filling Form3 controls I've got a command button to save the whole data entry... it works right but...

THE PROBLEM: when I save the data set I come back to show Form1; If I want to show Form 2 again, the controls are already filled with the data I entered before.. How can i make an automatic refresh of the form (better, of the controls that are inserted in the form) without make lines for each control? Why Excel doesn't make you Close a form as it happens in Access?

Thank You for your help!!!
mauro

New Folder/drive Controls
Aren't there any newer folder browsing controls other than the default ones that come with VB? like one control that has drives and folders in it instead of using 2 seperate controls.... I need to select folders so the common dialog control won't work either..

Data Enviroment, Not Refresh Bound Controls
Hi,

deMigs2.Commands("comGetkund").CommandType = adCmdStoredProc
deMigs2.Commands("comGetkund").CommandText = "sp_getkund"
deMigs2.Commands("comGetkund").Parameters("kundid").Value = Kundid
deMigs2.Commands("comGetkund").Execute

When I try this the first time it's working fine, Parameters kundid depends on choosen customer. When I go back to searchform and pick another customer, and Call the function to retrieve GetKund, the recordset will not be refreshed. It's still the first customer choosen.

What should I do?

Refresh the form?

Please Help me

Best Regards
/fredric

How To Download Attachments To Hard Drive Using MAPI Controls
Hello ,

I am using MAPI Controls for my Mail Application. I am able to Send Email with Attachments. But when I receive New Mails with Attachments , how do I download the Attachment physically into my Hard Drive by writing Code. MAPI is supporting with sending Attachments only with Outgoing messages.

Even I am unable to know the Receiving Attachment Count for my Incoming Mail from the Server.

Do U have any solution for my problem


Robert

Refer A Link To A File On The Disc Drive Self And Not To The Name Of The Disc Drive
In an Excel sheet I made buttons that refers to a file on the network. This sheet will be burned in mass production on cd.
Now I have the following question:
The macro’s refer to a file on the network, but now I going to burn it on CD. So the referring to the file on the network must be adjust to the file on the Disc-drive. But the problem is the name of the Disc drive. Not on any computer is the name of the disc drive the same. So I need a code that refers the link to the Disc drive self, and not to the name of the Disc drive. So the macro will work on every computer.

I hope that someone can help me with this…

File Size And Multiple Controls In A Single OCX (like Common Controls)
I have been working on several controls that all draw with similar graphic methods, such as UseXPTheme, System, OfficeXP, Office2003, etc. DaVBMan reminded me that I can have several public controls in a single ocx like the Common Controls do. So far I have an autohide toolbar, custom button, custom frame with titlebar, scrollable container, and a system listbox. I also have a few more ideas for additional controls.

Here is what my concern/question is. For arguments sake, let's say the name of my main ocx is IDKControls. Then pretend that the size of the complete ocx is 1 meg. Somebody adds a reference to my ocx so all these controls show up in their vb toolbox. Then let's say the only control from the ocx they use is the custom button. When they build their setup for their program, is the entire size of the main ocx included in their compiled app, or just my control(s) that they use?

I guess my primary reason for asking is I'm trying to decide whether to set my controls up as stand-alone controls, or whether to go with the main ocx that contains all the controls. If I go with a single ocx I can move most of my graphic methods to a module that would be used by all the controls.

I have learned a lot in the past few months about drawing custom graphics, but when it comes to designing something like this I am still dealing with some very large holes in my knowldedge! Thanks


God Bless America

Copy File From Resource File To Hard Drive As VbHidden
Is it possible to copy a file from the resource to the hard drive as vbHidden ?

I've made a Graphical User Interface for several commandline tools.
I want to include the commandline tools in a resource file and then
when the user starts the GUI, the commandline tools get extracted
to the hard drive as vbHidden.

Most people don't have "Show hidden files and folders" enabled.
This way it looks like there is only one app, instead of a GUI with
all kinds of extra apps, because that looks ugly (in my opinion).

This is the code I'm using now for one commandline tool.


VB Code:
Private Sub Form_Load()    Dim sBuffer As String    sBuffer = StrConv(LoadResData(101, "CUSTOM"), vbUnicode)    Open App.Path & "WhoLockMe.exe" For Output As #1    Print #1, sBuffer    Close #1End Sub

Refresh The Contains Of A File List Box
Hai guys, i got problem here. I got a file list box that display the contain of a folder. The folder contain wave files. What i need is that the file list box will refresh each time a wave file is added into the folder or deleted from the folder. what i mean is that when a wave file is saved in the folder, it's file name will directly appear on the file list box.When a wave file is deleted from the folder, it's file name will directly disappear from the file list box. What i have now is that i need to exit my application and restart my application so that the file list box will show the newly saved or deleted file name. Here is my code for the file list box:

Private Sub File1_Click()
File1.Path = "C:VMBVoice"
strFile = File1.Path & "" & File1.FileName
cmdPlay.Enabled = True
End Sub

Private Sub Form_Load()
File1.Path = "C:VMBVoice"

MMControl1.Visible = False
cmdPlay.Enabled = False
End Sub

This code is in a form for playing a wave file. The file list box show the available wave file to play. but it didn't show the new added or deleted wave file.

Please provide me with some help & sample code. Thanks Mate. Have A Nice Days.

Cannot Refresh Data Using Crystal Viewer Refresh Method
I am using crystal report 8.5 and Visual Basic 6.0

I get an error for this code.

crviewer1.refresh

error :

Method 'Refresh' of object 'IcrystalReportViewer' Failed


thank you ....

regards pragash...

A File To Be Run Only On One Drive.
How can we run a visual basic file that could only be run on one drive?
Example,it should only be run on A drive.And if it is runned in D or C drive,it should give a messages that this file can only be run on A drive.
PLease help me pals.Thank you so much just for reading my post.

How To Open Txt File In Filelistbox With Auto Refresh
how to open a selected txt file in filelistbox using a command button with auto update so that if there's a new logs will generate then it will update the listbox accordingly to the time ..
the logs has been set to hour:min:sec

here is the pic



thanks in advance

How To Refresh Word File In Internet Explorer?
Hi
I created a word file that has a mail merge that is supposed to be open in internet explorer.

The problem is now that it does not refresh and only get the data from the cache (just my though). When i put in a merge field at the IE, it will get refresh.

Anyone knows why?

Thus, i have no choice but to try if this works.

Enable the << ABC>> as can be seen below to force them to refresh in Internet explorer.

Anyone has any idea on how i can enable it? it is disabled

Some codes will be greatly appreciated !! or any other advice.

System Tray Refresh &amp; Creating A Txt File
HI,


When my app is unloaded the icon is removed from the tray, however it is still there until the user puts the cursor over the icon, so after i have removed it, how can i refresh it so that the icon also disapears instantly.


Also how do i create a file (i.e. a txt file)?


Thanks

How To Refresh RPT Crystal Report File Through VB Code
Hi friends,

As I am a biginer to crystal reports, i am facing some problem.....i need ur help..
I have created an RTP file and i am trying to open it in VB form load event .It's opened but it is not showing the current data from database. It is showing old data when i created the RPT file.
After opening report, how to refresh it......pls send me the Vb code to refresh RPT file.

I will be very thankfull if u send ASAP
Thanks & Regards
jagdish

Help {file, Folder, Or Drive}
How can i know if some path is file or folder or drive?

Thanks...

Opening File With The Cd Drive
I want to use my program to open a file from the cd drive. I also want to use the program on different computers. I know that the drive letter of my computer is different then the other computers. How do I open the file while accounting for the different drive letters?

Find A File On A Drive
Good morrow

As time passed drives change folders move and life forgets the old and recreates it. As a developer in government this is not the most efficient life. I am trying to build a futureproof db. One aspect it findinding files that ahve been moved. One poor example is a word doc which i use as a beginning for a document the databse automates. If the drive were to change in the future I would like to use vba find the file and change the relevant modules. I know how to find a file in a specific directory but not say if i want to search the whole C: drive and then return the path to that documnet without listing all folders in that drive and then searching each one individually, is this the only way??

kind regards

manic

How To Detect File In Drive
Hallo everybody...
I 'm having a problem to detect file for existing in drive. Could you please give me a very simple example.

Thanks...

Drive, Dir, File List...
Im making an app with load & save screens that use drive, dir & file lists to browse. Ive also got a text field that shows the Root, but i need to add "/" in myself. Thats a problem because when its top level there are 2 of them (C://). Is there some way to get that it is the top Level?

Aoeguy

Drive-Dir-File-ListBox
How can you make a DirListBox show the content of a drive selected from a DriveListBox and also how can you make a FileListBox show the content of a folder selected from a DirListBox ?

Writing File To Drive
This is the way I currently write the information that I created to disk. Does anyone see a way that I can speed it up.

Do While lLines <= UBound(ArrLines, 2)
For iFilePrz = 1 To UBound(ArrLines)
Open FileFinal For Append As #1
Print #1, ArrLines(iFilePrz, lLines)
Close #1
Next iFilePrz
lLines = lLines + 1
Loop


Thanks

Searching For A File On A Drive
How can i search for a specific file when the form loads and write the path to that file to an ini file?

Detecting A File In The Cd Drive
hi,

I've made a program which I want to distribute on cd-rom. Now I just need a way to protect it a bit more. Otherwise they could just give the cd to their mates - so one cd per computer, basically.

Here's what I need to acheive:

The cd must be in the cd-drive for the program to function. The program will run from the hard drive, but each time a user double clicks the shortcut on the desktop, the first thing that happens is that the cd-rom drive is checked to see if a file called 'Maths.exe' exists on a cd-rom in there.

If it exists, then my exe starts as normal.

If it doesn't exist, then a message box comes up, 'Put the Maths CD in the CD-ROM drive'.

Could anybody give me some code to do this? I've tried a few things, but the CD drive has to be called D: - no good, as it could be called e, or f, or g....

Thanks for any help!

File Copy From Drive To A: + More, Please Help!
hi im trying to make a program wich can send files from a specified dir to a: ...
my goal is to get tis working (below)
when i choose a drive in the DriveListBox i want the dirs to show up in the DirListBox and when choosing a dir i want the files to show in the FileListBox...
and when i highlight a file in the FileListBox and press the button send i want the file to be sent to A:

please, if you have any idea how to solve this please mail me!

Need To Copy File From A: To C: Drive.
Hi,
For my computing project I need some code to copy a file from the a: drive to drive c:.
Can anyone help please?

File And Drive Problems
1. How can I check if a directory exists and a file exists?

2. If I use a drivelist box to set the drive, along with the dirlist box, if I click on afloppy drive), without putting in a floppy it generates an error(because the chdir is related to chdrive)and the program terminates. How can I trap this error to tell the user to put in a floppy in the drive?

Search File In C Drive
search file in C drive

Hi there
I want to search a file in C drive and want to store location in string. How to do this?
I am trying using FSO Object is I am going in right direction ?

Thanks

Regards

Searching Drive For File
Hi
I am looking for the way to load a program (e.g a games .exe file) my problem is that because this file will be in different locations of different peoples drives I do not know how to "search the drive for the file" i can only search say an exact directory for the file using If dir(). Is there a way of searching an entire drive for a file? This is probably a simple question as I am just new to visual basics but all help is greatly apprieciated.
Thanks

Noyzy

VB6 - Drive, Dir, File ListBox
I am developing a form for the user Interface and I want to give user an ability to browse file/dir/drive list box to choose the file as an input. I don't know how to synchronise all three controls to work together on the form. I have following three controls on my form.
1) DriveListBox
2) DirListBox and
3) FileListBox
If I get the code sample from somebody for this, I will really apreciate it.

Thanks,
Pshah

NEEDING HELP With Refresh Datacombo Boxes Inclosed File
need ing help to refresh datacmbo box.. here i am adding the project to see the code and what others has said and i said go to the thread" NEEDING HELP with refresh datacombo boxes "
the vb project is enclosed... its all testing purposes and i will redo some of it when i can get the refresh to work... with out havin to close the project ... PLEASE help someone... this is driving me crazy

I Need Code To Create A Directory, And Copy Files From One Drive To Another Drive.
I am trying to find out if a batch file can be created using VB. One that will autorun(optional), create a directory on the c: drive, copy files from the cd-rom drive to the newly created directory on the c:/.

If this is possible, can you please help me come up with the code. I have never created a batch program before.

Thanks in advance

How To Read File From Floopy Drive?
Yost ,how i said.How to read files from floopy drive?
When i change drive and click file to read i get error"bad file name or ..."
But i dont wont to reading files just from floopy so i musnt type
open "a: ext.txt" for input as #1 case then i could read just that file.
I have made dialog box form for that(dir,file,drive controls).
I am opening files from file control(double clicking)!

Drive, Dir, And File Boxes Through WinSock
I'm trying to have my Drive, Dir, and File Boxes on a form on Computer A be able to load into a form on Computer B. So, I went and learned all I think I can stand about WinSock and how to use it and now I'm ready to go. EXCEPT, I want to make sure there is not an easier way to tackle this problem other than the one I'm about to do. My plan, for lack of a better idea, was to just convert each control's list into a String with | as the delimiter and then parse it on the Computer B and add it to a list.

For example, Computer A sends to Computer B...
Dim tmp As String
Dim i As Integer
tmp = "DRIVES"
For i = 0 To Drive1.ListCount - 1
tmp = tmp & Drive1.List(i) & "|"
Next i
Form1.Winsock1.SendData Left(tmp, Len(tmp)-1)

Computer B processes the data by...
'This is in DataArrival for my WinSock control (sckAccept)

Dim sData As String
sckAccept(Index).GetData sData

If Left(sData, 6) = "DRIVES" Then
Dim arr() As String
Dim i As Integer
arr = Split(Right(sData, Len(sData) - 6), "|")
For i = LBound(arr) To UBound(arr)
frmFileMan.Combo1.AddItem arr(i)
Next i

Now, this works but is a real pain in the * * * when it comes to changing drives, directories, etc. plus the directory list on Computer B is just a ListBox so it looks rather lame. If anyone has an idea/suggestion/insult for me, I'd be grateful. Thanks, Bill

Where Are The Drive, Directory, File Listboxes
Hi,
I am new to VB and I am taking a course soon in Using VBA with Arc Objects. A prerequisite is to have a basic understanding of VB so I am taking an online course in Intro to VB. Problem is the online course is based on a project using the drive, directory, and file listboxes controls. I have been all over the help files in MS Accesss (Office XP), ArcMap applications and the web looking to add them to VBA. Are they only inherent to VB6 ?

Copy A Zip File From A Network Drive
Hi!

I have created an application with VB6. The application copy a zip file from a network drive (from a shared folder). I run this application from a server. All things works perfect if I start the application manually but not as scheduled tasks. I have tried several work arounds with same results. If I automate from a local drive it works perfect but not from a network drive. I guess this has samething with permissions to do. Please, help me.

Drive, Directory And File Boxes
Silly question probably, but how can I make these items remember the last setting? I tried savesetting but it didn't work (maybe I chose the wrong property to save??)

To make it clearer I use the combination of these three boxes to allow a user to add MP3 files to a media player. I want it to default to the last directory they used rather than kicking back to the root everytime


Thanks in advance
Rick

How To Open An HTML File On My C Drive
I have the code to open an html page when i am trying to open websites. Like www.yahoo.com. However I would like to open and html file located on my system in the default browser.

Sample Address - c:windowsdesktopindex.html

How would I write the code for this?

Allen

Open A Map Or File From The Local Drive
This question might be very simple to all of you but I can't get it done by myself.
My question is: What is the code to place under a button to open a file or path on the local drive.

It would be great if someone could help me out.

Open File On Hard Drive
Hi,

I'm new to VB, i want to know if this can be done. From the net using Visual Basic, can i open a file on the C Drive and insert predefined data into it or modify existing data?

Thanks.

Accessing Mdb File From Network Drive
Hi all,
I ahve a serious problem and not able to resolve it with all the options I could try and so seeking the experts help. The scenario goes like this. I have a web based application which launches a vb .exe. This vb.exe is a application residing on the web server which needs to copy a file from a network drive to the C drive. The
sequence goes like the process starting from a asp page and then kicking off the vb .exe to be executed as a shell command and the vb .exe looks out for a .mdb file(Access database) just to copy it to C:. It does not need to open it.

The problem lies here. The vb application when kicked off from the asp page fails to see that a .mdb file even exists on the network drive. It works fine if the .mdb file is looked for in C:.
Also when the vb application is executed independantly, without being kicked off from the web page, the application succeeds in looking for the file on the network drive and copying it to the C: too. But the combination of asp page and the vb application and the network drive never works. I use FileSystemObject in the vb application to look for FileExists and then Copy the file. But FileExists itself returns false when the vb application is launched from asp page.

I tried to look for possible microsoft articles and then include permissions for the IIS USER which is USER_COMPUTERNAME and also include this user in the remote machine and give full permissions to the share on the remote machine etc. But nothing works. Please help

Drive / Sub Directory / File Sizes
I am hoping to be able to select a drive or path and list all the files along with properties ie name path and file sizes so I can identify which folders contain huge files ?

Has anyone done this and if so you got nay examples ??

Many Thanks

Patrick

File Attributes On Secondary Drive
I know you can use windows to protect the files on your hard drives, understand that pretty well.....however, does it also carry over it you take a hard drive out and connect it to another machine without the same security setup? What I mean is will the security measures persist if the hard drive itself is switched out? How could you make this happen other than running encryption on each and every file.....and if the other computer is using encryption can you still open the files??

Thanks,

David

How To Call An EXE File From Local Drive?
HI all

I am new in VB, I am using VB 6 Standard edition, I am trying to create a dialogue window with two bottons, I need to assign for each botton to call different EXE file, example: one of them will be as if its running from the CMD prompt, C:shutdown -r -t 3600.

Thats what I need to know:
1- how to call local files.
2- how to bring the dialogue window to the front, the user cannot close or switch applications

Thanks

WGeorges

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