|
-
Nov 1st, 2018, 05:19 PM
#1
Thread Starter
Lively Member
[RESOLVED] Load Textfile into two listboxes with substring in one
I am working on a program that opens a textfile into two listboxes using this code for each listbox (under form1_load event):
Dim lines() As String = IO.File.ReadAllLines(Application.StartupPath & "\Tasks Config Files\Run Commands.txt")
ListBox1.Items.AddRange(lines)
However, the problem is that every line in the text has two segments and each half gets loaded individually into each listbox. For example, the text file looks like:
Command Prompt***cmd.exe
Task Manager***taskmgr.exe
System Configuration***msconfig.exe
Then when it loads into listbox1, it needs to be everything before the three aesteriks. Example:
Listbox1_Items()
Command Prompt
Task Manager
System Configuration
& for listbox2, everything after the three asteriks. Example:
Listbox2_Items()
cmd.exe
taskmgr.exe
msconfig.exe
I started working on this using this code:
Dim phrase As String = ListBox1.Items.Item(count).Split("***")(1)
and then I created a loop. However, I have not had any success. Again, I need to be able to load the substrings and afterstrings into the corresponding listboxes. Please help? Suggestions?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|