JMcilhinney gave you good advice on how to approach programming generally. To answer this question...
Code:Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim lines() As String = IO.File.ReadAllLines("E:\Desktop\Run Commands.txt") Dim first() As String = Array.ConvertAll(lines, Function(l As String) l.Split(New String() {"***"}, StringSplitOptions.RemoveEmptyEntries)(0)) Dim second() As String = Array.ConvertAll(lines, Function(l As String) l.Split(New String() {"***"}, StringSplitOptions.RemoveEmptyEntries)(1)) ListBox1.DataSource = first ListBox2.DataSource = second End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged If ListBox1.Items.Count = 0 Or ListBox2.Items.Count = 0 Then Return ListBox2.SelectedIndex = ListBox1.SelectedIndex End Sub Private Sub ListBox2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox2.SelectedIndexChanged If ListBox1.Items.Count = 0 Or ListBox2.Items.Count = 0 Then Return ListBox1.SelectedIndex = ListBox2.SelectedIndex End Sub End Class




Reply With Quote
