Follow us on Twitter!
I'd prefer to die standing, than to live on my knees - Che Guevara
Saturday, April 19, 2014
Navigation
Home
HellBoundHackers Main:
HellBoundHackers Find:
HellBoundHackers Information:
Learn
Communicate
Submit
Shop
Challenges
HellBoundHackers Exploit:
HellBoundHackers Programming:
HellBoundHackers Think:
HellBoundHackers Track:
HellBoundHackers Patch:
HellBoundHackers Other:
HellBoundHackers Need Help?
Other
Members Online
Total Online: 27
Guests Online: 26
Members Online: 1

Registered Members: 82839
Newest Member: fezphantom
Latest Articles
View Thread

HellBound Hackers | Computer General | Programming

Author

Making a text editor in VB.net 08


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-07-09 23:04
I want to make a text editor in vb.net, a proper one that lets you save files, but all the examples i have found dont allow you to save, only do pointless stuff like change the colour. Can anyone help?
Author

RE: Making a text editor in VB.net 08

p4plus2
Member

Your avatar

Posts: 167
Location:
Joined: 31.03.08
Rank:
Newbie
Posted on 25-07-09 23:15
I don't know vb.net but here how I am *guessing* you could do it.
(pseudo code I think you'll manage translating it)
Code

var textfield = new text();
textfield.display(100, 200);

var save = new button();
save.onclick(savetext());

function savetext()
{
     var file = fopen("file.txt", 'w');
     file.fwrite(textfield.get_text);
     file.close();
}





Not sure how well that can translate to VB.NET but if you can manage it, it will work.


"You can't be something your not,
Be yourself by yourself
Stay away from me" ~Walk, Pantera

"Playing an acoustic guitar is like having sex with your clothes on" ~Dave Mustaine
p4plus2@hotmail.com
Author

RE: Making a text editor in VB.net 08


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-07-09 23:18
No, as far as i can remember you need to use something called IOstream or reader or something like that
Author

RE: Making a text editor in VB.net 08


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 25-07-09 23:31
Here's how you can create and/or write to a file:

Dim writer As StreamWriter = _
New StreamWriter("filepath")
writer.WriteLine(information to be written to file)
writer.Close()

Check out http://support.mi. . ./kb/304427 For file I/O


Author

RE: Making a text editor in VB.net 08

p4plus2
Member

Your avatar

Posts: 167
Location:
Joined: 31.03.08
Rank:
Newbie
Posted on 25-07-09 23:44
Orillian wrote:
No, as far as i can remember you need to use something called IOstream or reader or something like that


Because that is pseudo code, code that represented in generic format so it is simple to translate to another language. In you case VB.NET.


"You can't be something your not,
Be yourself by yourself
Stay away from me" ~Walk, Pantera

"Playing an acoustic guitar is like having sex with your clothes on" ~Dave Mustaine
p4plus2@hotmail.com
Author

RE: Making a text editor in VB.net 08


Member

Your avatar

Posts:
Location:
Joined: 01.01.70
Rank:
Guest
Posted on 27-07-09 00:52
Here is a piece of code from one of my projects. It still needs to be refined, and I'm sure there are other way to do it, but this is how I did it:

Code

'The code in the most of this is for a function like "Save As" like in most text editors
    Private Sub SaveAsToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveAsToolStripMenuItem.Click
        ' Create a SaveFileDialog to request a path and file name to save to.
        Dim saveFile1 As New SaveFileDialog()
        saveFile1 = SaveFileDialog1

        Dim JDBoolean As Boolean 'JD stands for JohnDoe since its just random, it will be used to declare  if the Form should use the FileSaveDialog's Name
        JDBoolean = False

        ' Initialize the SaveFileDialog to specify the RTF extension for the file.
        saveFile1.DefaultExt = "*.txt"
        saveFile1.Filter = "TXT Files|*.txt"

        ' Determine if the user selected a file name from the saveFileDialog.
        If (saveFile1.ShowDialog() = System.Windows.Forms.DialogResult.OK) _
            And (saveFile1.FileName.Length) > 0 Then

            ' Save the contents of the RichTextBox into the file.
            RichTextBox1.SaveFile(saveFile1.FileName, _
                RichTextBoxStreamType.PlainText)
            JDBoolean = True
        Else : MessageBox.Show("You must enter a file name")
            JDBoolean = False
        End If
    End Sub

'The next few lines of code are for a button such as "Save" which is found in most text editors
    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
        RichTextBox1.SaveFile("NoteBook.txt")
        'Using SaveFile Method to save text in a rich textbox to hard disk
    End Sub





Hope this helps