Click here to Skip to main content
15,887,333 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got an coding like which is used to copy files from desktop to Removable device. But it is working in VB.net and windows 7. Most of our PCs are windows XP. Can you please tell me how to downgrade the coding to VB6 which is able to run on windows XP also.

What I have tried:

VB.NET
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim Gig As Long = 1073741824L
        Dim FolderToCopy As String = My.Computer.FileSystem.SpecialDirectories.Desktop

        Try
            For Each Drive As IO.DriveInfo In IO.DriveInfo.GetDrives
                Select Case True
                    Case Not Drive.DriveType = IO.DriveType.Removable
                    Case Not Drive.IsReady
                    Case Not Drive.AvailableFreeSpace >= 2 * Gig
                    Case Else
                        Debug.Print("Copying {0} to {1}", FolderToCopy, Drive.RootDirectory.FullName)
                        My.Computer.FileSystem.CopyDirectory(FolderToCopy, Drive.RootDirectory.FullName, True)

                        ' Only do the copy once to first appropriate drive
                        Exit For
                End Select
            Next
        Catch ex As Exception
            Debug.Print(ex.ToString)
        End Try

    End Sub
End  class 
Posted
Updated 3-Nov-16 22:51pm
Comments
Ralf Meier 4-Nov-16 4:39am    
Win-XP is also able to run .Net Applications. It depends on the installed .Net-Framework on the Workstation AND then .Net-Framework your Application is designed with ...
Richard MacCutchan 4-Nov-16 4:42am    
The only way to make the code VB6 compatible is to re-write it.
CHill60 12-Nov-16 20:52pm    
I've come across a similar issue. The thing to remember is that if you have built (compiled) a VB.NET application on a Windows 7 platform it will probably not run on an XP platform. However, the reverse is not true... if you build from the source code on XP it will run on both XP AND Win7.
Don't, don't, don't convert .NET to VB6 for this. Just don't do it.

1 solution

VB6 is not that similar to .NET - although you can use some VB6 code directly in a .NET application, the reverse is not true: you can use NO .NET specific code in a VB6 application.
You would either have to rewrite your newer code in VB6, using the software as a "template" to guide you, or install .NET on XP machines.
.NET V4 can be installed on XP machines: Installing the .NET Framework 4 on Windows XP | .NET Blog[^] so if you target your software to V4 or below, you can run the more mordern software directly without change (provided that it's built for x86 or you are running an 64 bit version of XP)
 
Share this answer
 
Comments
S.SAKTHYBAALAN 4-Nov-16 6:30am    
If it is possible could you able to rewrite it in VB6 ?
OriginalGriff 4-Nov-16 7:30am    
No! It's your job, not mine - you do get paid for it after all...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900