Sending Path Files From DataGridView To USB Drive Nothing Happen?
Apr 9, 2012
I'm attempting to create the sending path files from each rows of Datagridview to USB removable Drive. Below the code i''ve got from Shanks it's just show the name of usb drives but when i clicked on sendto not work.
I'm running the following WMI script to get the associations between drive letters and physical drives on the system, but for some reason it omits CDROMs/DVD-ROMs. Can someone tell me how to get those as well?
Code: ComputerName = "." Set wmiServices = GetObject _ ("winmgmts:{impersonationLevel=Impersonate}!//" & ComputerName) Set wmiDiskDrives = wmiServices.ExecQuery _ ("SELECT DeviceID FROM Win32_DiskDrive")
I'm coding this neat little project that's kind of a hack into the SanDisk U3 Cruzer's ability to have both a CDFS and FAT32 File System. This is helpful because the program is burned to the CDFS (It's basically slip streamed as an .ISO in place of the original U3 .ISO), and the settings files (which I've developed as text files) are placed on the root of the flash drive. The program itself is VERY simple actually, except I'm having a slight issue that's really driving me insane:
The drive path of the Flash Drive won't be the same from computer to computer. I.E... The files are "UAI.txt" and "UInfo.txt". The root of the drive on my comp is "I:", but on my laptop is "F:". So if I program the path from my computer as the absolute path, an exception is thrown when the path changes on another computer. I cannot have this happen. It is probably THE MOST crucial element to this program. How can you save and read info if you can't find the files? =P
So I've gone through so many threads and forums trying to find a batch of code to allow me to make the path relative. I've found the following code (modified, of course). It works PERFECT in Debug, but throws an exception once packaged to the CDFS partition:
I am trying to create a function to convert a mapped drive path to a UNC path. I did some googling and found several different pages on the matter. I am most interested in the first one, but I cannot seem to get the code to cooperate. Since the original post was in C#, here is my VB.NET conversion:
The drive is connected via USB and the problem I'm having is that, periodically, while my code is executing, the usb drive seems to disconnect and reconnect. (Nothing to do with the program, but the drive itself).I want to find a way to prevent these temporary drive reconnects from interrupting my code. IE, i want to insure that whatever read or write that is requested is actually executed even in the case of a temporary drive interruption.
I am using some like following code to get UNC path of drive letter. Dim query As New System.Management.ObjectQuery("select * from Win32_LogicalDisk") Using searcher As New System.Management.ManagementObjectSearcher(Query) 'loops for all drives on system For Each Mgmt As System.Management.ManagementObject In searcher.Get()
And it was working but now it is giving error. Below is error with stack trace {"Specified cast is not valid."} at System.Management.ThreadDispatch.Start() at System.Management.ManagementScope.Initialize() at System.Management.ManagementObjectSearcher.Initialize() at System.Management.ManagementObjectSearcher.Get()
I also want to know alternative way to get unc path of drive that is also not depend on windows API. As there is a class driveinfo to get all drives (including network) on system. Is there any class that also provide complete or unc path information of Drive.
We are getting a new server and we already have a Z: drive mapped, and we want to use the same letter and just change the path without touching all machines. I am looking for a simple VBscript to do that. I have one that will remove and one that will add, but I need to have on script.
I was expecting this to be easy but it seems that it is not... all I want to do is loop through all drives on a computer and if the drive is a network drive then get the UNC path that this network drive maps to. Simples. I was expecting to just do this:
vb.net For Each drv In IO.DriveInfo.GetDrives() If drv.DriveType = IO.DriveType.Network Then MessageBox.Show(drv.RootDirectory.ToString) End If Next
ListBox1.Items.Clear() Dim di As New IO.DirectoryInfo(TextBox1.Text) Dim aryFi As IO.FileInfo() = di.GetFiles("*.*")[code]......
and that displays only the file name, like text.txt but i want it to display C:/Text.txt and all the files in the subfolders too, like C:/Program Files/Test2.txt but i just get test.txt from only the c:/ .
I've been created the contact name with a photo storing on datagridview and i'd like to create the context menustrip of "Send To" by right click on the the row of datagridview and sed to USB drive. Need helping from visual basic forum.
I am trying to copy files from one drive to another. I am a novice at Visual Basic, but here are the facts. I am running Windows XP, and Microsoft Visual Studio 2008. I work at a business where we need to move a small amount of data every Sunday, literally about 100k, a few small files. I'm trying to cut and paste the files as we will not need them in the main file any longer. There's also the network issue, I'm trying to pull them off a LAN, onto my computer, specifically the G: drive to the C: drive.
This is what I put so far:
vb Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click FileCopy.CopyFiles("G:SharedSFMachinesTemp&HumidityTracking", "C:Richard's Stuff") End Sub
I'm making a program which will open .rtf files into a rich text box by pressing a button. I can't seem to make it work. I'm trying to make the Go Button on Form 1 open the selected rtf file and put it into the rich text box on form 2.
Dim file As String = (destination) ReadFrm.ShowDialog() My.Forms.ReadFrm.bookrtb.Text = file
Nothing seems to happen It's trying to read from the C:\Program Files directory.
I need to MOVE a batch of files from one drive to another one by one.How can I know when one file as completed the MOVING process so I the other file in row can start moving
At this time I am using VBScript to drive files thru a printer driver. Each file has to be ran at all the different preferences the drivers can offer. (papersize, dpi, simplex/duplex, etc.). I am developing a VB application and I want to drive the files with the app. I want to make setting changes with my app. and then set the driver accordingly and run the files. When I finish I want to dynamiclly change the settings and then run the files again. Until I have driven them with all the different settings.
I am using this code to get files, but I can not get it to search for all files on C: drive.how can I get it to show all files Like *.pdf of the drive in the list box
Imports System.IO Imports System Imports System.Drawing
I'm using the following code to get all of the files from a DVD drive and load them into a bindinglist and then a datagridview:
mAddBL.Clear() ' Try Dim dir As New IO.DirectoryInfo(Form1.m_DVDdrive & ":")
[Code]....
This shows all files and folder names on the disc. If I want it to show all files, regardless of the folder they're in, is there a built-in method to do that or do I need to take an entry, identify it as a directory and then use that as my source to read the files in it?
Is it possible to copy files from my resources to the hard drive? In other words, I have a few files located in My.Resources & I would like to copy them as needed to the users HD.
I am very new to programming and I am having trouble getting my code to work properly.I am trying to write what I thought was a simple program, but I everything I have tried has not worked properly.I am creating a utility that will take installation and database files from one computer and copy those files to a flash drive so the flash drive will have the new version. The flash drives in question would either have one of two previous versions of the software on it or it will be blank. I decided to do this in two steps. First I check the computer for the new database and the flash drive for the old ones. I do this with the following code. [code] Next, I am deleting files from the flash drive if the old database is there and copying the files from the computer to the flash drive and showing progress on the progressbar. Here is where I am going all wrong. I have tried it a number of different ways, and unfortunatly (I'm kicking myself right now), I have not saved the code from the other methods I have tried.I have not been able to figure out how to get the background worker to work with what I am trying to do, though I have seen a lot of code over the past few weeks with examples of how to use it. It is a little above my head in terms of figuring it out by myself. So what I have used is the following code: [code]
I am trying to write what I thought was a simple program, but I everything I have tried has not worked properly.Here is what I am trying to do... am creating a utility that will take installation and database files from one computer and copy those files to a flash drive so the flash drive will have the new version. The flash drives in question would either have one of two previous versions of the software on it or it will be blank. I decided to do this in two steps. First I check the computer for the new database and the flash drive for the old ones. I do this with the following code.
Private Sub VerifyButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles VerifyButton.Click VerifyButton.Enabled = False