Solved

Index was outside the bounds of the array. TextChanged

Posted on 2014-07-27
2
115 Views
Last Modified: 2014-07-27
        initials = New String(word.Split(" "c).Select(Function(f) f(0)).ToArray).ToUpper()

Open in new window

 For Each ch As Char In word
            
                If Not Char.IsWhiteSpace(ch) Then
                    intCount += 1
               
            End If

Open in new window

I am using function TextChanged, this problem works with a button but when typeing the text when I get to a space I get and error from initials
Index was outside the bounds of the array.
with my above example how can this be fixed.
0
Comment
Question by:sevensnake77
2 Comments
 
LVL 85

Accepted Solution

by:
Mike Tomlinson earned 500 total points
Comment Utility
Try this out instead:
initials = String.Join("", word.Split(" ").Select(Function(f) If(f.Length = 0, "", f.Substring(0, 1).ToUpper)).ToArray)

Open in new window

0
 
LVL 9

Author Closing Comment

by:sevensnake77
Comment Utility
Great, thanks
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Article by: Kraeven
Introduction Remote Share is a simple remote sharing tool, enabling you to see, add and remove remote or local shares. The application is written in VB.NET targeting the .NET framework 2.0. The source code and the compiled programs have been in…
Introduction As chip makers focus on adding processor cores over increasing clock speed, developers need to utilize the features of modern CPUs.  One of the ways we can do this is by implementing parallel algorithms in our software.   One recent…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
When you create an app prototype with Adobe XD, you can insert system screens -- sharing or Control Center, for example -- with just a few clicks. This video shows you how. You can take the full course on Experts Exchange at http://bit.ly/XDcourse.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now