Advertisement
TheVideoVolcano

---Write files from resources folder in VB.NET--

Apr 16th, 2013
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.32 KB | None | 0 0
  1. '---Write files from resources folder in VB.NET--'
  2.  
  3. '---------------------------VB.net write txt files from resources-----------------------------------
  4. '---------------------------------------------------------------------------------------------------'
  5.  
  6. Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  7.  
  8.         SaveFromResources("C:\Users\Ric\Desktop\crock\file1.txt", My.Resources.file1)
  9.  
  10.     End Sub
  11.  
  12. Private Sub SaveFromResources(ByVal FilePath As String, ByVal File As String)
  13.  
  14.             Dim strin As String = File
  15.             My.Computer.FileSystem.WriteAllText(FilePath, strin, True)
  16.  
  17.     End Sub
  18.  
  19. '---------------------------VB.net write .exe files from resources-----------------------------------'
  20. '---------------------------------------------------------------------------------------------------'
  21.  
  22.     Private Sub Button4_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
  23.  
  24.         SaveFromResources("C:\Users\Ric\Desktop\crock\application.exe", My.Resources.my_application)
  25.  
  26.     End Sub
  27.  
  28. Private Sub SaveFromResources(ByVal FilePath As String, ByVal File As Object)
  29.  
  30.             Dim FByte As Byte() = File
  31.             My.Computer.FileSystem.WriteAllBytes(FilePath, FByte, True)
  32.  
  33.         End If
  34.     End Sub
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement