Advertisement

03.12.2008 at 09:54AM PDT, ID: 23235794
[x]
Attachment Details

Loop through labels

Asked by Millkind in Visual Studio .NET 2003

Why would this code through this error?

3/12/2008 12:51:08 PM - System.InvalidCastException: Cast from string "lbviewerday2" to type 'Integer' is not valid. ---> System.FormatException: Input string was not in a correct format.
   at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value, NumberFormatInfo NumberFormat)
   at Microsoft.VisualBasic.CompilerServices.DoubleType.Parse(String Value)
   at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
   --- End of inner exception stack trace ---
   at Microsoft.VisualBasic.CompilerServices.IntegerType.FromString(String Value)
   at BulletHoleEventsCalendar.Form1.viewerload() in C:\Documents and Settings\mdmiller\My Documents\Visual Studio

Seems to be pretty straightforward code.Start Free Trial
1:
2:
3:
For x As Integer = 2 To 10
            Me.viewer.Controls("lbviewerday" & x.ToString).Text = Date.Today.ToLongDateString
        Next
[+][-]03.12.2008 at 09:59AM PDT, ID: 21108109

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.12.2008 at 10:19AM PDT, ID: 21108386

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]03.12.2008 at 11:00AM PDT, ID: 21108888

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Visual Studio .NET 2003
Sign Up Now!
Solution Provided By: FernandoSoto
Participating Experts: 2
Solution Grade: A
 
 
[+][-]03.12.2008 at 11:03AM PDT, ID: 21108920

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628