Click here to Skip to main content
15,880,891 members
Articles / Desktop Programming / MFC
Article

Simple File Creation Form and text manipulation class

Rate me:
Please Sign up or sign in to vote.
1.00/5 (12 votes)
24 Feb 20042 min read 39.1K   460   10   4
A windows form and class for text & file's.

Sample Image - Simple_filetxt_routines.gif

Introduction

    I am pretty new to the programming world and "VERY" new to the note of C sharp, and have never wrote an article or anything of the like. This will not be the most descriptive page, though "MOST OF THE CODE IS DOCUMENTED" I feel if you download the code and walk thru it, everyone should be able to understand it. I tend to learn at a faster pace by 'doing' first, rather than reading first.  ( Always reading after seems to help then go back and step through code again ) Works for me!
    I had a small project to do that required a little file.txt manipulation, which frustrated me to no end. There is allot of "Tutorial" style stuff I found on the web, and allot of other unanswered newbies questions but nothing I could get my brain around quickly. So I decided that I would spin my own small project that I could understand. This is not the cleanest and has some error handling in it. (also "I am sure" has plenty of room for improvement so feel free to modify and send or post improvements! :-)
I will try to go thru the code/this article in my free time and add a little more explanation.

Using the code

   There are no real surprises here. This code is pretty straight forward. Push a button "Create Directory" and yes you create a directory...Push a button you create a file and so on.
   In the win form I removed as much code as possible and converted it to a class "namespace FILE_MODS" & "public class FileIO". Many of these concepts I implemented are from the web, some book's or really bad trial's and some really interesting errors. There is a separate class inside the FileIO for the ListBox and it has some weird errors that would happen during build/run if I didn't add it a false array... (Don't really 100% grasp why) If somebody can review this code, and get some explaination of it that would be awesome.
   Also use regex and a few other things I overturned along this road. There are a few links inside the code for where I found the original code, when I remembered to put them there.
(If you see some code that I yanked without links, PLEASE let me know as I would really like to give credit where it is due. ) 

 

Points of Interest

This started out as a single windows form only. After which I decided that if I made a class I could reuse it quickly and easily. So that is what I did. Also added a text box to "read" the file into, and a listbox that "loops" through the strings to display a line @ a time.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Systems / Hardware Administrator Custom Integration Tech
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
GeneralMy vote of 1 Pin
ndinges10-Mar-09 3:49
ndinges10-Mar-09 3:49 
please delete this piece of s...
GeneralAwesome Sample dude Pin
jas0n236-Sep-08 0:22
jas0n236-Sep-08 0:22 
GeneralLook at your code Pin
ByteGhost9-Mar-04 17:39
ByteGhost9-Mar-04 17:39 
GeneralI'm sorry... Pin
David M. Kean25-Feb-04 12:12
David M. Kean25-Feb-04 12:12 

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.