?
Solved

Index was outside the bounds of the array. TextChanged

Posted on 2014-07-27
2
Medium Priority
?
125 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:Seven price
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 2000 total points
ID: 40223012
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:Seven price
ID: 40223026
Great, thanks
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
Creating an analog clock UserControl seems fairly straight forward.  It is, after all, essentially just a circle with several lines in it!  Two common approaches for rendering an analog clock typically involve either manually calculating points with…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

777 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