Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Option Strict On
- Imports System.Net
- Imports System.IO
- Imports System.Text.RegularExpressions
- Imports System.Text
- Imports System.Web
- Imports System
- Public Class Form1
- Private meinRegex As New Regex("<.*?model=""(\d*)"".*?dimension=""(\d*)"".*?></object>", RegexOptions.Multiline)
- Dim curStatus As String = "-"
- Dim integerwert As Integer = 0
- Private myList As New List(Of String)
- Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
- ListBox1.Items.Clear()
- ListBox2.Items.Clear()
- Dim t As New OpenFileDialog
- If t.ShowDialog = vbOK Then
- Dim pfad As String = t.FileName
- Dim mytext As String = My.Computer.FileSystem.ReadAllText(pfad)
- Dim myTextList = mytext.Split(CChar(vbNewLine))
- For Each line In myTextList
- 'ListBox1.Items.Add(line)
- 'ListBox2.Items.Add(line)
- myList.Add(line)
- Next
- Me.ListBox1.DataSource = myList
- End If
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- RadioButton2.Select()
- End Sub
- Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
- Try
- Dim ntext As Integer = CInt(TextBox1.Text)
- Try
- integerwert = CInt(TextBox2.Text)
- Catch ex2 As Exception
- Return
- End Try
- Catch ex As Exception
- Return
- End Try
- If RadioButton1.Checked = True Then
- curStatus = "+"
- Else
- curStatus = "-"
- End If
- Dim mydex As Integer = 0
- Dim groups1 As GroupCollection
- For Each item In ListBox1.Items
- mydex += 1
- ' Hier abfragen
- Dim MC1 As MatchCollection = meinRegex.Matches(CStr(item))
- If MC1.Count > 0 Then
- For Each items As Match In MC1
- groups1 = items.Groups
- Dim sell As Integer = groups1.Count()
- If (groups1.Item(1).Value()) = TextBox1.Text Then
- Dim curDIm As Integer = CInt(groups1.Item(2).Value())
- If curStatus = "-" Then
- Dim newvalue As Integer = (curDIm - integerwert)
- 'ListBox2.Items.RemoveAt(mydex)
- 'ListBox2.Items.Add(groups1.Item(0).Value.Replace("dimension=""" & curDIm & """", "dimension=""" & newvalue & """"))
- myList(mydex) = groups1.Item(0).Value.Replace("dimension=""" & curDIm & """", "dimension=""" & newvalue & """")
- Me.ListBox1.DataSource = Nothing
- Me.ListBox1.DataSource = myList
- Else
- Dim newvalue As Integer = (curDIm + integerwert)
- 'ListBox2.Items.RemoveAt(mydex)
- myList(mydex) = groups1.Item(0).Value.Replace("dimension=""" & curDIm & """", "dimension=""" & newvalue & """")
- 'ListBox2.Items.Add(groups1.Item(0).Value.Replace("dimension=""" & curDIm & """", "dimension=""" & newvalue & """"))
- Me.ListBox1.DataSource = Nothing
- Me.ListBox1.DataSource = myList
- End If
- End If
- Next
- End If
- Next
- End Sub
- Private Sub ListBox2_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged
- Try
- TextBox3.Text = ListBox2.SelectedItem.ToString
- Catch ex As Exception
- End Try
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement