View Single Post
  #1  
Old 01-18-2009, 03:08 PM
--BulletMagnet-- is offline --BulletMagnet--
--BulletMagnet--'s Avatar
DF2 Forever

Join Date: Jun 2005
Location: USA
Posts: 718

Send a message via MSN to --BulletMagnet--
Wink Read .MIS files with Style. (VB.net)

VB.net is great for beginners. Especially the intellisense features. Highly recommended.

This is just in case anyone wants to learn, im not selfish with my source code, at least not yet on these little programs.

Code:
Public Class Form1
    Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object,ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click

        'Create a new dialog
        Dim o As New OpenFileDialog

        o.Title = "Choose MIS"

        o.Filter = "Mission File (*.MIS)|*.MIS"

        If o.ShowDialog = Windows.Forms.DialogResult.OK Then
            'Import dialog selection from user to RichTextBox
            datainputbu.Text = My.Computer.FileSystem.ReadAllText(o.FileName)

        End If
    End Sub

    Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click

        'Create new save dialog
        Dim s As New OpenFileDialog

        s.Title = "SaveMIS"

        s.Filter = "Mission File (*.MIS)|*.MIS"

        If s.ShowDialog = Windows.Forms.DialogResult.OK Then

            'Save the file as plain text, as to not lose any formatting
            datainputbu.SaveFile(s.FileName, RichTextBoxStreamType.PlainText)

        End If
    End Sub

   
    Private Sub BackgroundColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BackgroundColorToolStripMenuItem.Click

        'Create new color dialog for background color of RichTextBox
        Dim cd1 As New ColorDialog

        If cd1.ShowDialog = Windows.Forms.DialogResult.OK Then

            'Set backcolor to user selection
            datainputbu.BackColor = cd1.Color

        End If


    End Sub

    Private Sub TextColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextColorToolStripMenuItem.Click

        'Create new color dialog for text color
        Dim cd2 As New ColorDialog

        If cd2.ShowDialog = Windows.Forms.DialogResult.OK Then

            'Set text color to selection
            datainputbu.ForeColor = cd2.Color

        End If

    End Sub

    Private Sub CutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CutToolStripMenuItem.Click

        datainputbu.Cut()

    End Sub

    Private Sub CopyToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopyToolStripMenuItem.Click

        datainputbu.Copy()

    End Sub

    Private Sub PasteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PasteToolStripMenuItem.Click

        datainputbu.Paste()

    End Sub

    Private Sub SelectAllToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SelectAllToolStripMenuItem.Click

        datainputbu.SelectAll()

    End Sub

    Private Sub FontToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontToolStripMenuItem.Click

        'Create new font dialog
        Dim font As New FontDialog

        If font.ShowDialog = Windows.Forms.DialogResult.OK Then
            'Use font selected by user
            datainputbu.Font = font.Font

        End If

    End Sub
End Class


(The background and text colors can be changed to whatever, the font as well. You can open and save .MIS files. No complex features yet though I have some in mind.

Copyright © 2008 Bullet Magnet. All wrongs reserved.
Reply With Quote