nvc944 Posted May 29, 2003 Posted May 29, 2003 Ok guys I am working on a simple program a command button that will find a file and rename it. is there a simple way.. I was thinking of using the shell command but does not quite work the way I wanted to. can someone please give me a quick code as I am sure this is very simple thanks guys Quote
Moderators Robby Posted May 29, 2003 Moderators Posted May 29, 2003 You mentioned Shell command, do you want to start an external app? If so, try this... Dim WithEvents myP As Process Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myP = Process.Start("c:\winnt\system32\notepad.exe") myP.EnableRaisingEvents = True End Sub Private Sub myP_Exited(ByVal sender As Object, ByVal e As System.EventArgs) Handles myP.Exited MessageBox.Show("Application Exited") End Sub You can rename a file by making a copy then delete the original. Dim f As System.IO.File f.Copy("c:\Test.txt", "c:\testing.txt") f.Delete("c:\Test.txt") Quote Visit...Bassic Software
*Gurus* Derek Stone Posted May 29, 2003 *Gurus* Posted May 29, 2003 Dim sPath1 As String = "D:\file1.ext" Dim sPath2 As String = "D:\file2.ext" If File.Exists(sPath1) Then File.Move(sPath1, sPath2) End If Quote Posting Guidelines
nvc944 Posted May 30, 2003 Author Posted May 30, 2003 hmm Code works great but when I compile it and save it as an .exe it works on my main machine but not the others. is there a fix? Quote
Administrators PlausiblyDamp Posted May 30, 2003 Administrators Posted May 30, 2003 The other machines will need to have the .Net framework installed. Quote Posting Guidelines FAQ Post Formatting Intellectuals solve problems; geniuses prevent them. -- Albert Einstein
nvc944 Posted May 30, 2003 Author Posted May 30, 2003 oh.. so how does one create.. oh.. so how does one create.. an application in .net and run it on other machines.. if they do not have that installed? might as well go vb6 Quote
*Gurus* divil Posted May 30, 2003 *Gurus* Posted May 30, 2003 VB6 requires runtimes too. If you want an application that doesn't require runtimes, use a language like C or C++. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
AndreRyan Posted May 31, 2003 Posted May 31, 2003 C++ uses a runtime too just not very often In 2008 Microsoft won't support VS6 casuing .Net to be the only choice anyway. The next version of Windows will probably have the .Net framework included. Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
*Gurus* Derek Stone Posted May 31, 2003 *Gurus* Posted May 31, 2003 C++ uses a runtime too just not very often Microsoft's Foundation Classes (MFC) are not C++ runtimes, and shouldn't be misconstrued as such. These classes are entirely optional, and are not required by any means. Quote Posting Guidelines
AndreRyan Posted June 1, 2003 Posted June 1, 2003 Actually I was thinking of msvcp50.dll, msvcp60.dll, msvcp70.dll. They all contain the phrase: "Microsoft ® C++ Runtime Library" Quote .Net allows software to be written for any version of Windows and not break like Unmanaged applications unless using Unmanaged procedures like APIs. If your program uses large amounts of memory but releases it when something else needs it, then what's the problem?
dcZ Posted June 3, 2003 Posted June 3, 2003 You mentioned Shell command, do you want to start an external app? If so, try this... Dim WithEvents myP As Process Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load myP = Process.Start("c:\winnt\system32\notepad.exe") myP.EnableRaisingEvents = True End Sub Private Sub myP_Exited(ByVal sender As Object, ByVal e As System.EventArgs) Handles myP.Exited MessageBox.Show("Application Exited") End Sub You can rename a file by making a copy then delete the original. Dim f As System.IO.File f.Copy("c:\Test.txt", "c:\testing.txt") f.Delete("c:\Test.txt") Great was looking how to do this, only in c#. Pretty straightforward tho. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.