Programacion vb.net
PRIMERO CREAR :
-1 TextBox
-1 Menu Strip
LUEGO EN LA BARRA DE PROPIEDADES CAMBIAR EL NAME DEL TEXBOX POR DOCUMENT Y EN EL MENU STRIP CREAR TRES SUB-MENUS:
ARCHIVO ,EDICION Y FORMATO
• EN ARCHIVO: ABRIR , GUARDAR Y SALIR
• EN EDICION: DESHACER, COPIAR , PEGAR . CORTAR , SELECCIONAR TODO Y LIMPIAR TEXTO
• EN FORMATO: FUENTE Y COLOR
AGREGAR1 SaveFileDialog, 1 OpenFileDialog, 2 ColorDialog, 1 FontDialog, 1 Printdialog y 1 PrintDocument
LOS CODIGOS SON :
Para Abrir:
Dim Open As New OpenFileDialog()
Dim myStreamReader AsSystem.IO.StreamReader
Open.Filter = "Text [*.txt*]|*.txt|All Files [*,*]|*,*"
Open.CheckFileExists = True
Open.Title = "Abrir Archivo"
Open.ShowDialog(Me)
Try
Open.OpenFile()
myStreamReader= System.IO.File.OpenText(Open.FileName)
document.Text = myStreamReader.ReadToEnd()
Catch ex As Exception
End Try
Para Guardar:
Dim Save As New SaveFileDialog()
Dim myStreamWriter AsSystem.IO.StreamWriter
Save.Filter = "Text (*.txt)|*.txt|HTML(*.html*)|*.html|PHP(*.php*)|*.php*|All files(*.*)|*.*"
Save.CheckPathExists = True
Save.Title = "Guardar como"Save.ShowDialog(Me)
Try
myStreamWriter = System.IO.File.AppendText(Save.FileName)
myStreamWriter.Write(document.text)
myStreamWriter.Flush()
Catch ex As Exception
End Try
Para Salir :
Me.Close()Para Copiar:
document.copy()
Para Cortar:
document.Cut()
Para Pegar:
document.Paste()
Para Deshacer:
document.Undo()
Para Fuente:
Try
Dim dlg As FontDialog = NewFontDialog
dlg.Font = document.font
If dlg.showdialog = System.Windows.Forms.DialogResult.OK Then
document.Font = dlg.Font
End If
Catch ex As Exception: End Try
Para Color:
Try
Dimdlg As ColorDialog = New ColorDialog
dlg.Color = document.Forecolor
If dlg.ShowDialog = System.Windows.Forms.DialogResult.Ok Then
document.Forecolor = dlg.Color
End If
Catch ex As Exception...
Regístrate para leer el documento completo.