[Vb.net] Write folder with files from resource to..

Posts 16–24 of 24 · Page 2 of 2
thanks but how can you copy the file from resources.
Quote Originally Posted by ppl2pass View Post
thanks but how can you copy the file from resources.
Add this sub:

Sub SaveResourceImage( ByVal ResourceName As String , ByVal TargetLocAndFilename As String )
Dim obj As Object
Dim Bitmap As Bitmap
obj = My.Resources.ResourceManager.GetObject(ResourceNam e)
Bitmap = obj
Bitmap.Save(TargetLocAndFilename)
End Sub

Then call the sub from where ever you want, like:

SaveResourceImage( "Wikipedia", "C:\wiki.jpg")
'Here Resource Image is Wikipedia which must exist in my resources.

'Here "C:\wiki.jpg" is the location and name where I would save the file extracted from the resource



Hope you got it !
can you do this for .xml files? and btw thanks
bump i still need help for .xml file.
Quote Originally Posted by ppl2pass View Post
bump i still need help for .xml file.
I have to install VB... Re-Installed windows....Gimme half an hour...
Add This Sub:

Sub SaveXML( ByVal resourcename As String , ByVal location As String )
Dim obj As Object
obj = My.Resources.ResourceManager.GetObject(resourcenam e)
My.Computer.FileSystem.WriteAllText(location,obj, False )
End Sub

Then call it from anywhere:

SaveXML( "ppl2pass", "D:\ppl2pass.xml")
'Here ResourceName is ppl2pass which must exist in my resources.

'Here "D:\ppl2pass.xml" is the location and name where I would save the xml file extracted from the resource.

'Note that if you have an xml file named "ppl2pass.xml" in the resource, you will use it without extension like "ppl2pass", or else it won't work.

Hope this helps
Quote Originally Posted by Blubb1337 View Post
Code:
 Public Sub MoveFiles(ByVal sourcePath As String, ByVal DestinationPath As String)
        If (Directory.Exists(sourcePath)) Then
            For Each fName As String In Directory.GetFiles(sourcePath)
                If File.Exists(fName) Then
                    Dim dFile As String = String.Empty
                    dFile = Path.GetFileName(fName)
                    Dim dFilePath As String = String.Empty
                    dFilePath = DestinationPath + dFile
                    File.Move(fName, dFilePath)
                End If
            Next
        End If
    End Sub
aggain -.-"
Quote Originally Posted by /b/oss View Post


aggain -.-"
Stop spamming please !!!
Posts 16–24 of 24 · Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Talk with us