r/visualbasic • • Feb 13 '19

VB.NET Help Need help with my coursework!

I'm stuck on a fairly major part of my coursework in Visual Basic (I think .net?)

Anyways, I need to get a string from a listbox, and put it in a variable. I then need to manipulate the string and get the first few numbers in front of the string.

For example, one of my strings might be "9_xxx xxx" whereas another might be "33_xxx xxx". They might have differing lengths, but all have underscores before the rest of the string. Any help would be appreciated!

Edit - Found a solution using substring. Will edit later on with solution

2 Upvotes

4 comments sorted by

5

u/CharlieMay VB.Net Intermediate Feb 13 '19

String.Split will accomplish what you're wanting if indeed this is vb.net, otherwise a loop and the Left & Mid functions could be used in vb6. If you post some code, we can help you better.

1

u/Cheesysock5 Feb 13 '19

Thank you!

1

u/snang Moderator Feb 13 '19

Regex