2024-06-07 00:11:48 +02:00
|
|
|
|
Imports System.IO
|
|
|
|
|
Imports System.Windows.Forms.VisualStyles.VisualStyleElement
|
|
|
|
|
|
|
|
|
|
Public Class Form2
|
|
|
|
|
|
|
|
|
|
Public DatotekaSpemembe As Boolean = False
|
|
|
|
|
Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Activated
|
|
|
|
|
' PropertyGrid1.SelectedObject = My.Settings
|
|
|
|
|
' ' Attribute for the user-scope settings.
|
|
|
|
|
' Dim userAttr As New System.Configuration.UserScopedSettingAttribute
|
|
|
|
|
' Dim attrs As New System.ComponentModel.AttributeCollection(userAttr)
|
|
|
|
|
' PropertyGrid1.BrowsableAttributes = attrs
|
|
|
|
|
Form1.Hide()
|
|
|
|
|
BtnShraniF2.Enabled = False
|
|
|
|
|
RichTextBox1.Clear()
|
|
|
|
|
|
|
|
|
|
' prepare StreamReader
|
|
|
|
|
Dim streamReader As StreamReader = New StreamReader(Form1.OpenFileDialog1.FileName)
|
|
|
|
|
Dim i As Integer = 0
|
|
|
|
|
|
|
|
|
|
' loop untill end of stream
|
|
|
|
|
Do Until streamReader.EndOfStream
|
|
|
|
|
' Beri vrstico po vrstico
|
|
|
|
|
Dim line As String = streamReader.ReadLine()
|
|
|
|
|
RichTextBox1.AppendText(line + vbCrLf)
|
|
|
|
|
i = i + 1
|
|
|
|
|
Loop
|
|
|
|
|
ToolStripStatusLabel1.Text = "Vrstic: " + i.ToString + "| Datoteka: " + Form1.OpenFileDialog1.FileName
|
|
|
|
|
DatotekaSpemembe = False
|
|
|
|
|
streamReader.Close()
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub Form2_Close(sender As Object, e As EventArgs) Handles MyBase.Closing
|
|
|
|
|
If DatotekaSpemembe = True Then
|
|
|
|
|
MessageBox.Show("Podatki spremenjeni... Shranim spremembe?", "Podatki spremenjeni", MessageBoxButtons.YesNo)
|
|
|
|
|
If DatotekaSpemembe = True Then
|
|
|
|
|
RichTextBox1.SaveFile(Form1.OpenFileDialog1.FileName, RichTextBoxStreamType.PlainText)
|
|
|
|
|
BtnShraniF2.Enabled = False
|
|
|
|
|
End If
|
|
|
|
|
End If
|
|
|
|
|
Form1.Show()
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub RichTextBox1_TextChanged(sender As Object, e As EventArgs) Handles RichTextBox1.TextChanged
|
|
|
|
|
ToolStripStatusLabel1.Text = "Spremenjeni podatki... datoteka je bila urejana."
|
|
|
|
|
BtnShraniF2.Enabled = True
|
|
|
|
|
DatotekaSpemembe = True
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub BtnShraniF2_Click(sender As Object, e As EventArgs) Handles BtnShraniF2.Click
|
|
|
|
|
SaveFileDialog1.FileName = Path.GetFileNameWithoutExtension(Form1.OpenFileDialog1.FileName)
|
|
|
|
|
If SaveFileDialog1.ShowDialog = DialogResult.OK Then
|
|
|
|
|
RichTextBox1.SaveFile(SaveFileDialog1.FileName, RichTextBoxStreamType.PlainText)
|
|
|
|
|
ToolStripStatusLabel1.Text = "Shranjeno: " + SaveFileDialog1.FileName.ToString
|
|
|
|
|
BtnShraniF2.Enabled = False
|
|
|
|
|
DatotekaSpemembe = False
|
|
|
|
|
End If
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub ToolStripButton2_Click(sender As Object, e As EventArgs) Handles ToolStripButton2.Click
|
|
|
|
|
RichTextBox1.Focus()
|
|
|
|
|
RichTextBox1.SelectionStart = RichTextBox1.GetFirstCharIndexOfCurrentLine
|
|
|
|
|
SendKeys.Send("+{HOME}")
|
|
|
|
|
If ComBoxKoda.SelectedIndex = 0 Then
|
|
|
|
|
RichTextBox1.SelectedText = "*410000+0000000000000010 " + vbCrLf
|
|
|
|
|
BtnShraniF2.Enabled = True
|
|
|
|
|
DatotekaSpemembe = True
|
|
|
|
|
ElseIf ComBoxKoda.SelectedIndex = 1 Then
|
|
|
|
|
RichTextBox1.SelectedText = "*410000+0000000000000020 " + vbCrLf
|
|
|
|
|
BtnShraniF2.Enabled = True
|
|
|
|
|
DatotekaSpemembe = True
|
|
|
|
|
ElseIf ComBoxKoda.SelectedIndex = 2 Then
|
|
|
|
|
RichTextBox1.SelectedText = "*410000+0000000000000030 " + vbCrLf
|
|
|
|
|
BtnShraniF2.Enabled = True
|
|
|
|
|
DatotekaSpemembe = True
|
|
|
|
|
ElseIf ComBoxKoda.SelectedIndex = 3 Then
|
|
|
|
|
RichTextBox1.SelectedText = "*410000+0000000000000040 " + vbCrLf
|
|
|
|
|
BtnShraniF2.Enabled = True
|
|
|
|
|
DatotekaSpemembe = True
|
|
|
|
|
ElseIf ComBoxKoda.SelectedIndex = 4 Then
|
|
|
|
|
RichTextBox1.SelectedText = "*410000+0000000000000050 " + vbCrLf
|
|
|
|
|
BtnShraniF2.Enabled = True
|
|
|
|
|
DatotekaSpemembe = True
|
|
|
|
|
ElseIf ComBoxKoda.SelectedIndex = 5 Then
|
|
|
|
|
RichTextBox1.SelectedText = "*410000+0000000000000090 " + vbCrLf
|
|
|
|
|
BtnShraniF2.Enabled = True
|
|
|
|
|
DatotekaSpemembe = True
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
Private Sub ToolStripButton1_Click(sender As Object, e As EventArgs) Handles ToolStripButton1.Click
|
|
|
|
|
RichTextBox1.Undo()
|
2024-06-02 05:35:03 +02:00
|
|
|
|
End Sub
|
|
|
|
|
End Class
|