Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Moving a file in vb

So I have a .dll file that I want to move from my reasources to the selected path from FolderBrowserDialog1 with a button click but after trying a few different things I still cant find something that works, anybody got any ideas of how this could be done ? Thanks. 🤝

Here's what i've tryed;
PHP Code

<?php 
My
.Computer.FileSystem.MoveFile(My.Resources.clr.ToString, FolderBrowserDialog1.SelectedPath) 
and
PHP Code

<?php 
Dim FileToMove 
As String
      Dim MoveLocation 
As String

      FileToMove 
= True

      FileToMove 
= "My.Resources.clr"
      
MoveLocation = FolderBrowserDialog1.SelectedPath

      
If System.IO.File.Exists(FileToMove) = True Then

      System
.IO.File.Move(FileToMove, MoveLocation)
      
MsgBox("File Moved")

      
End If 
and others i found online but can't remember.
A .dll stored in the resources would be stored as Bytes[].

This means you will want to do something along the lines of:

Code
Using(var Stream = new StreamWriter(FolderBrowserDialog1.SelectedPath)
    Stream.Write(My.Resources.clr.ToArray();

The above is C#, and you'll need to convert it to VB if you want to use it. It may also throw errors due to being typed of the top of my head.
Tryed converting but it threw back some errors, not moved into C# yet either, thanks for the help though. 🤝
(Sep 26, 2014 12:09 AM)scaa Wrote:  Tryed converting but it threw back some errors, not moved into C# yet either, thanks for the help though. 🤝

Look up a tutorial for Writing Byte's to a file for VB, that's the basic concept that you want to look at. Sorry the code wasn't of more help.
do you get any error ?

you can try writeallbytes

Dim data() As Byte = System.IO.File.ReadAllBytes(fileToMove)
System.IO.File.WriteAllBytes(path, data)


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by thatitguyAug 18, 2018 03:03 AM 1 112 Aug 18, 2018 03:03 AM
Last Post: Lagging_BarISH
[C#] by DaaksinNov 12, 2012 01:23 AM 8 223 Nov 12, 2012 01:23 AM
Last Post: Daaksin
[Python] by NeedlzMay 27, 2012 03:04 AM 5 148 May 27, 2012 03:04 AM
Last Post: dsMadKilla11