Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
50
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Imports System.Windows.Forms
  2. Imports System.IO
  3. Public Class Form1
  4.     Dim ofd As New OpenFileDialog
  5.     Dim sfd As New SaveFileDialog
  6.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  7.  
  8.     End Sub
  9.  
  10.     Private Sub ExitToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ExitToolStripMenuItem.Click
  11.         Me.Close()
  12.     End Sub
  13.  
  14.     Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click
  15.         With ofd
  16.             .Filter = ("Text Files|*.txt")
  17.             .ShowDialog()
  18.             .FileName = " "
  19.  
  20.             If .ShowDialog = 1 Then
  21.                 IO.File.ReadAllText(ofd.FileName)
  22.             End If
  23.         End With
  24.     End Sub
  25.  
  26.     Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged
  27.  
  28.     End Sub
  29.  
  30.     Private Sub SaveToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveToolStripMenuItem.Click
  31.         With sfd
  32.             .Filter = ("Text Files|*.txt")
  33.             .ShowDialog()
  34.             .FileName = ""
  35.  
  36.             If .ShowDialog = 1 Then
  37.                 IO.File.WriteAllText(.FileName, TextBox1.Text)
  38.             End If
  39.         End With
  40.     End Sub
  41.  
  42.     Private Sub SaveFileDialog1_FileOk(ByVal sender As System.Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles SaveFileDialog1.FileOk
  43.  
  44.     End Sub
  45.  
  46.     Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click
  47.         MessageBox.Show("Created by Shannon!")
  48.     End Sub
  49. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement