Código:
aka esta la funcion de abrir solita Public Class Form1 Private Sub ToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub GuardarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GuardarToolStripMenuItem.Click RichTextBox1.Clear() End Sub Private Sub AbrirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AbrirToolStripMenuItem.Click Try Dim dlg As OpenFileDialog = New OpenFileDialog dlg.Title = "Open" dlg.Filter = "Documento de texto (*.txt)|*.txt" If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then RichTextBox1.LoadFile(dlg.FileName) End If Catch ex As Exception : End Try End Sub Private Sub GuardarToolStripMenuItem1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GuardarToolStripMenuItem1.Click Try Dim dlg As SaveFileDialog = New SaveFileDialog dlg.Title = "Documento de texto (*.txt)|*.txt" If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then RichTextBox1.SaveFile(dlg.FileName, RichTextBoxStreamType.RichText) End If Catch ex As Exception : End Try End Sub Private Sub RehacerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RehacerToolStripMenuItem.Click RichTextBox1.Undo() End Sub Private Sub DeshacerToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DeshacerToolStripMenuItem.Click RichTextBox1.Redo() End Sub Private Sub ToolStripMenuItem4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ToolStripMenuItem4.Click RichTextBox1.Cut() End Sub Private Sub CopiarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CopiarToolStripMenuItem.Click RichTextBox1.Copy() End Sub Private Sub PegarToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PegarToolStripMenuItem.Click RichTextBox1.Paste() End Sub Private Sub LimpiarTodoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LimpiarTodoToolStripMenuItem.Click RichTextBox1.Clear() End Sub Private Sub SeleccionarTodoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SeleccionarTodoToolStripMenuItem.Click RichTextBox1.SelectAll() End Sub Private Sub ColorToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorToolStripMenuItem.Click Try Dim dlg As FontDialog = New FontDialog dlg.Font = RichTextBox1.Font If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then RichTextBox1.Font = dlg.Font End If Catch ex As Exception : End Try End Sub Private Sub FuenteToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FuenteToolStripMenuItem.Click Try Dim dlg As ColorDialog = New ColorDialog dlg.Color = RichTextBox1.ForeColor If dlg.ShowDialog = System.Windows.Forms.DialogResult.OK Then RichTextBox1.ForeColor = dlg.Color End If Catch ex As Exception : End Try End Sub Private Sub ColorDeFondoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ColorDeFondoToolStripMenuItem.Click ColorDialog1.ShowDialog() RichTextBox1.BackColor = ColorDialog1.Color End Sub Private Sub DatoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DatoToolStripMenuItem.Click Dim d As String = My.Computer.Clock.LocalTime.Date RichTextBox1.Text = RichTextBox1.Text + d End Sub Private Sub TiempoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TiempoToolStripMenuItem.Click Dim h As String = My.Computer.Clock.LocalTime.Hour Dim m As String = My.Computer.Clock.LocalTime.Minute If m < 10 Then m = "0" + m If h > 12 Then h = h - 12 Dim time As String = h + ":" + m If h > 12 Then time = time + " AM" If h < 12 Then time = time + " PM" RichTextBox1.Text = RichTextBox1.Text + time End Sub Private Sub TiempoDatoToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TiempoDatoToolStripMenuItem.Click Dim h As String = My.Computer.Clock.LocalTime.Hour Dim m As String = My.Computer.Clock.LocalTime.Minute Dim d As String = My.Computer.Clock.LocalTime.Date If m < 10 Then m = "0" + m If h > 12 Then h = h - 12 Dim time As String = h + ":" + m If h > 12 Then time = time + " AM" If h < 12 Then time = time + " PM" RichTextBox1.Text = RichTextBox1.Text + time + ", " + d End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load End Sub Private Sub SalirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SalirToolStripMenuItem.Click End End Sub End Class
Código:
Espero que se entienda, y gracias de antemano, y como les repido solo abre los archivos creados en mis editor pero no los del block de notas de windows Private Sub AbrirToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AbrirToolStripMenuItem.Click Try Dim dlg As OpenFileDialog = New OpenFileDialog dlg.Title = "Open" dlg.Filter = "Documento de texto (*.txt)|*.txt" If dlg.ShowDialog() = System.Windows.Forms.DialogResult.OK Then RichTextBox1.LoadFile(dlg.FileName) End If Catch ex As Exception : End Try End Sub