25 lines
927 B
VB.net
25 lines
927 B
VB.net
Public Class frmXmlEditor
|
|
Public Property FileName As String
|
|
|
|
Private Sub frmXmlEditor_Load(sender As Object, e As EventArgs) Handles MyBase.Load
|
|
If FileName Is Nothing OrElse FileName = String.Empty Then
|
|
MsgBox("Kein Dateiname übergeben!", MsgBoxStyle.Critical, Text)
|
|
Exit Sub
|
|
End If
|
|
|
|
If Not IO.File.Exists(FileName) Then
|
|
MsgBox("Datei existiert nicht!", MsgBoxStyle.Critical, Text)
|
|
Exit Sub
|
|
End If
|
|
|
|
Try
|
|
Dim oContents = IO.File.ReadAllText(FileName)
|
|
RichEditControl1.Text = oContents
|
|
Catch ex As Exception
|
|
MsgBox($"Fehler beim Laden der Datei: {ex.Message}", MsgBoxStyle.Critical, Text)
|
|
End Try
|
|
|
|
RichEditControl1.Document.DefaultCharacterProperties.FontName = "Consolas"
|
|
RichEditControl1.Document.DefaultCharacterProperties.FontSize = 9
|
|
End Sub
|
|
End Class |