Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2010 Find the last line and increase it (More info in thread).

$
0
0
I'm new to this forum and to VB.NET, and I have a hard time looking for a solution to what I want to achieve. I know posting here without even trying is plain spoonfeed, but I tried and failed. I really don't know how to achieve this. I have a TextBox control with MultiLine. This TextBox control has a lot of text in it. For example, the text is:

Quote:

Hey everyone.

Welcome!

Thanks for coming.

if (status == 0)
After I click the button, I want it to find the last line that has (status == x) where x represents the number. If the number is 0, such as in the case above, it will add another line at the bottom saying: "} else if (status == 1)", because x + 1 = 1. If the case was:

Quote:

Hey everyone.

Welcome!

Thanks for coming.

if (status == 0)
Hello.
} else if (status == 1)
It will add "} else if (status == 2) {", because x + 1 = 2, where x is 1.

How can I do that? I have tried but I'm new and I have no idea. I know how to find the last line and check using Trim, and maybe find the LastIndexOf("status == "), but I don't know how to find the number of the status and increase it.

Thanks.

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>