You are on page 1of 2

Public Class frmDialogos

Dim sArchivo As String = ""


Private Sub CargarFormulario(ByVal sender As System.Object, ByVal e As Syste
m.EventArgs) Handles MyBase.Load
Dim aSoftware As New ArrayList
With aSoftware
.Add("Adobe Photoshop CS5")
.Add("Adobe IIutrator CS5")
.Add("Adobe Visual Studio 2008")
.Add("Microsfot SQL Server 2008")
.Add("Adobe DremWeaver CS5")
End With
lstSoftware.DataSource = aSoftware
End Sub
Private Sub CambiarFuente(ByVal sender As System.Object, ByVal e As System.E
ventArgs) Handles mnuFuente.Click
Dim oFuente As New FontDialog
oFuente.Font = lstSoftware.Font
oFuente.ShowColor = True
If oFuente.ShowDialog = Windows.Forms.DialogResult.OK Then
lstSoftware.Font = oFuente.Font
lstSoftware.ForeColor = oFuente.Color
txtTexto.Font = oFuente.Font
txtTexto.ForeColor = oFuente.Color
End If
End Sub
Private Sub CambiarColor(ByVal sender As System.Object, ByVal e As System.Ev
entArgs) Handles mnuColor.Click
Dim oColor As New ColorDialog
oColor.Color = lstSoftware.ForeColor
If oColor.ShowDialog = Windows.Forms.DialogResult.OK Then
lstSoftware.ForeColor = oColor.Color
End If
End Sub
Private Sub MotarBarra(ByVal sender As System.Object, ByVal e As System.Even
tArgs) Handles mnuBarra.Click
Dim Estado As Boolean = Not mnuBarra.Checked
mnuBarra.Checked = Estado
stsEstado.Visible = Estado
End Sub
Private Sub AbrirArchivo(ByVal sender As System.Object, ByVal e As System.Ev
entArgs) Handles mnuAbrir.Click
Dim ofd As New OpenFileDialog
ofd.Title = "Seleccione un Archivo de Texto..."
ofd.InitialDirectory = "D:\"
ofd.Filter = "Archivos de Texto (*.txt)|*txt"
If ofd.ShowDialog = Windows.Forms.DialogResult.OK Then
sArchivo = ofd.FileName
Dim sr As New System.IO.StreamReader(sArchivo)
txtTexto.Text = sr.ReadToEnd
sr.Close()
End If
End Sub

Private Sub GuardarCambios(ByVal sender As System.Object, ByVal e As System.


EventArgs) Handles btnGuardar.Click
If sArchivo.Length > 0 Then
'GuardarCambios el archivo
Dim sw As New System.IO.StreamWriter(sArchivo)
sw.Write(txtTexto.Text)
sw.Close()
Else
MessageBox.Show("No existe ningun Archivo...")
End If
End Sub
End Class

You might also like