Foros del Web » Programación para mayores de 30 ;) » .NET »

Ayuda con editor de textos visual basic

Estas en el tema de Ayuda con editor de textos visual basic en el foro de .NET en Foros del Web. Bueno ya tengo el editor, funciona perfectamente bueno casi, el problema es que no puedo abrir los archivos hecho en block de notas "winbdows" sino ...
  #1 (permalink)  
Antiguo 07/07/2009, 12:10
 
Fecha de Ingreso: junio-2008
Ubicación: Guatemla
Mensajes: 31
Antigüedad: 15 años, 10 meses
Puntos: 0
Ayuda con editor de textos visual basic

Bueno ya tengo el editor, funciona perfectamente bueno casi, el problema es que no puedo abrir los archivos hecho en block de notas "winbdows" sino que solo puedo abrir los txt hechos en mi Edito, sin mas que decir paso a mostrarles el codigo

Código:
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
aka esta la funcion de abrir solita

Código:
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
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
  #2 (permalink)  
Antiguo 07/07/2009, 15:59
 
Fecha de Ingreso: junio-2008
Mensajes: 54
Antigüedad: 15 años, 9 meses
Puntos: 19
Sonrisa Respuesta: Ayuda con editor de textos visual basic

Oye, si puedes sube tu proyecto en un Zip a tu cuenta de hotmail, en el Skydrive, igual y asi nos es mas facil poder ver que esta pasando.
  #3 (permalink)  
Antiguo 07/07/2009, 16:31
 
Fecha de Ingreso: enero-2007
Ubicación: Tingo María - Perú
Mensajes: 399
Antigüedad: 17 años, 3 meses
Puntos: 13
Respuesta: Ayuda con editor de textos visual basic

hasta donde tengo entendido el richtextBox abre archivos RTF mas no txt, puedes usar alguna funcion para abrir archivos txt y asignarle a tu richTextbox, pero directamente usar el LoadFile no creo que se pueda
__________________
Vivir para ser buenos y ser buenos para servir mejor.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 13:38.