I wanted to have an image in the resources (none made yet) and have it copied out the resources and placed along with the webpages (to use it as background image). I have tried a lot (clearly not everything or it would work) but I just don't manage to solve this. the problem is I need to be able to do this, since I want to have my .accdb in the resources to, so that it copies out when used an writes (an updated version) back to the resources and deletes the external file. but I never seem to manage to do this. I tried to read,write and other things it with IO and everything, just getting the message that it cannot be read. but I never seem to find how to copy/move it outside the program. the code I am using now looks like this:
Imports System.Reflection
Imports System.IO 'this is for the writing of the .HTML files
Imports System
Public Class webGenerator
Private Sub webgenerating_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles webGenerating.DoWork
Dim naam As String = NaamTextBox.Text.ToString
Dim achternaam As String = AchternaamTextBox.Text.ToString
Dim leeftijd As String = LeeftijdTextBox.Text.ToString
Dim ID As String = IDTextBox.Text.ToString
Dim destkop As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Directory.CreateDirectory(destkop + "\websites\")
Dim writer As StreamWriter = New StreamWriter(destkop + "\websites\" + naam + "_Profilepage.html")
writer.WriteLine("<html>")
writer.WriteLine("<head><title>Hello world!</title><style>html{background-color:#b0c4de;}#profile{ position: relative; top: 5em; left: 6em; }</style></head>")
writer.WriteLine("<body>")
writer.WriteLine("<div id='profile'>")
writer.WriteLine("<p>your name is: " + naam + " " + achternaam + "</p>")
writer.WriteLine("<p>your age is: " + leeftijd + "</p>")
writer.WriteLine("<p>with ID " + ID + "</p>")
writer.WriteLine("</div>")
writer.WriteLine("</body>")
writer.WriteLine("</html>")
writer.Close()
Me.PersoneelBindingSource.MoveNext()
End Sub
Private Sub PersoneelBindingNavigatorSaveItem_Click(sender As Object, e As EventArgs) Handles PersoneelBindingNavigatorSaveItem.Click
Me.Validate()
Me.PersoneelBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.BedrijfDataSet)
End Sub
Private Sub webGenerator_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'BedrijfDataSet.personeel' table. You can move, or remove it, as needed.
Me.PersoneelTableAdapter.Fill(Me.BedrijfDataSet.personeel)
End Sub
Private Sub generateAll_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles generateAll.DoWork
Dim amount As Integer = Me.PersoneelBindingSource.Count
Dim current As Integer = 0
Me.PersoneelBindingSource.MoveFirst()
While current < amount
If webgenerating.IsBusy = False Then
webgenerating.RunWorkerAsync()
current = current + 1
End If
End While
End Sub
Private Sub btnGenerateAll_Click(sender As Object, e As EventArgs) Handles btnGenerateAll.Click
MsgBox("generating all webpages, starting when you close this pop-up box", MsgBoxStyle.Information)
generateAll.RunWorkerAsync()
MsgBox("Done!", MsgBoxStyle.Information)
End Sub
Private Sub btnGenerateThis_Click(sender As Object, e As EventArgs) Handles btnGenerateThis.Click
MsgBox("generating a webpage for this profile only: " + Me.NaamTextBox.Text.ToString, MsgBoxStyle.Information)
webGenerating.RunWorkerAsync()
MsgBox("Done!", MsgBoxStyle.Information)
End Sub
End Class
any help is appreciated, if you have suggestions by the way I am intrested to hear them

New Topic/Question
Reply



MultiQuote




|