Click here to Skip to main content
16,005,121 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: task bar button doesn't work Pin
Dave Kreskowiak5-Apr-04 11:29
mveDave Kreskowiak5-Apr-04 11:29 
GeneralRe: task bar button doesn't work Pin
skoizumi291105-Apr-04 13:42
sussskoizumi291105-Apr-04 13:42 
QuestionDateTimePicker DropDown? Pin
Dino685-Apr-04 7:42
Dino685-Apr-04 7:42 
QuestionDateTimePicker DropDown? Pin
Dino685-Apr-04 7:41
Dino685-Apr-04 7:41 
AnswerRe: DateTimePicker DropDown? Pin
sagmam23-Jul-04 6:58
sagmam23-Jul-04 6:58 
AnswerRe: DateTimePicker DropDown? Pin
Anonymous23-Jul-04 8:48
Anonymous23-Jul-04 8:48 
General"Specified Cast Not Valid" Pin
nvmoss5-Apr-04 5:41
nvmoss5-Apr-04 5:41 
QuestionHow to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 5:06
Codemonkey855-Apr-04 5:06 
So yeah, I need some help. I want to create a sub that will allow me to select a source file, select a destination text (.txt) file, and write to that text file the code neccessary to programatically create the source file.

Why would I do such a ludicrously convoluted thing, you ask?

1) I need to create programs that automatically detect whether or not there is a certain file in the root folder, and if that file doesn't exist, I want it to create the file (i.e. a ReadMe file, usually an HTML file).
2) Since they are usually HTML files and I know squat about HTML, it would be easier just to create the file (using OpenOffice.Org in my case), and automate the arduous task of retrieving the HTML source.
3) I don't really have a third thing, but I felt three was the neccessary number of topics to address, and figured it'd be lame to stop at two.

Here's what I have so far:

Public Sub FileCopyCode()<br />
    'Declaring variables<br />
    Dim FileOpen As OpenFileDialog<br />
    Dim SourcePath, OutPath As String<br />
    Dim FileSave As SaveFileDialog<br />
    Dim SourceFile As System.IO.File<br />
    Dim SourceWrite As System.IO.StreamWriter<br />
    'Starting the procedure<br />
    FileOpen.ShowDialog()<br />
    SourcePath = FileOpen.FileName<br />
    FileSave.Filter = "Text File|txt"<br />
    FileSave.ShowDialog()<br />
    OutPath = FileSave.FileName<br />
    SourceWrite = SourceFile.CreateText(OutPath)<br />
    Dim SourceRead As System.IO.StreamReader<br />
    SourceRead = SourceFile.OpenText(SourcePath)<br />
    'Now, if I could just set up a loop starting here...<br />
    '::Count number of lines in source file, loop following_<br />
    '_procedure that many times::<br />
    SourceWrite.WriteLine("FilePut(1, " & SourceRead.ReadLine)<br />
    '...and ending about here, then maybe I could copy_<br />
    '_each line with the FilePut thing in front, and boom!  I'd have_<br />
    '_what I want<br />
End Sub 'How to programatically create a text file containing the <br />
'_VB.Net code neccessary for recreating a different file programatically<br />


Any help is appreciated, thanks.

As I sit here, I contemplate the last words of Socrates: "I drank what?".
AnswerRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 7:23
Nadroj5-Apr-04 7:23 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 17:19
Codemonkey855-Apr-04 17:19 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 18:52
Nadroj5-Apr-04 18:52 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 19:56
Codemonkey855-Apr-04 19:56 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 20:08
Nadroj5-Apr-04 20:08 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj5-Apr-04 20:15
Nadroj5-Apr-04 20:15 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey855-Apr-04 21:52
Codemonkey855-Apr-04 21:52 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj6-Apr-04 3:01
Nadroj6-Apr-04 3:01 
AnswerRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Dave Kreskowiak6-Apr-04 0:56
mveDave Kreskowiak6-Apr-04 0:56 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey856-Apr-04 11:50
Codemonkey856-Apr-04 11:50 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Nadroj6-Apr-04 11:52
Nadroj6-Apr-04 11:52 
GeneralRe: How to programatically create a text file containing the VB.Net code neccessary for recreating a different file programatically Pin
Codemonkey856-Apr-04 16:38
Codemonkey856-Apr-04 16:38 
GeneralSerializing Pin
Anonymous5-Apr-04 4:51
Anonymous5-Apr-04 4:51 
GeneralRe: Serializing Pin
Alberto Venditti5-Apr-04 21:12
Alberto Venditti5-Apr-04 21:12 
GeneralRe: Serializing Pin
Randy S6-Apr-04 15:01
Randy S6-Apr-04 15:01 
GeneralApplication with Socket Programming Pin
rajamca20034-Apr-04 20:39
rajamca20034-Apr-04 20:39 
GeneralRe: Application with Socket Programming Pin
adarsh_m4-Apr-04 23:44
adarsh_m4-Apr-04 23:44 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.