|
-
Feb 24th, 2015, 07:18 PM
#1
Thread Starter
Lively Member
Picking Out Specific Lines In Console
So I made a Console Application. In it has a user setting. In this setting looks like:
1(Empty)
2(Empty)
3(Empty)
4(Empty)
5(Empty)
6(Empty)
I Want the user to be able to edit the specific lines in this setting. I don't think it is possible to do this in the settings so if there is another way, please help me. I don't know how to get or change a specific line. I tried:
Console.WriteLine(My.Settings.UserContent.Line1) <-But it obviously did not work because you can not get lines like that from the settings.
-
Feb 24th, 2015, 07:51 PM
#2
Re: Picking Out Specific Lines In Console
That setting is presumably a String, so it presumably contains line breaks. In that case, you can split that single String into an array of substrings on those line breaks, e.g.
Code:
Dim lines As String() = My.Settings.UserContent.Split({Environment.NewLine}, StringSplitOptions.None)
After editing individual lines, you can put the lot back together using String.Join.
-
Feb 24th, 2015, 07:52 PM
#3
Thread Starter
Lively Member
Re: Picking Out Specific Lines In Console
awesome. Thank you!!!!
-
Feb 24th, 2015, 07:56 PM
#4
Re: Picking Out Specific Lines In Console
I just noticed that you are using VB 2008. In that case, you would have to be explicit about creating the array for the first argument, i.e.:
Code:
Dim lines As String() = My.Settings.UserContent.Split(New String() {Environment.NewLine}, StringSplitOptions.None)
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
|