Advertisement

11.30.2005 at 11:11AM PST, ID: 21648328
[x]
Attachment Details

Using C# Substring with variables

Asked by ara99 in C# Programming Language

Tags: substring

Why the heck can't I do this in C#???

strIDVals = "IN (" + this.Label4.Text.Substring(strIDHeader.Length, this.Label4.Text.Length) + ")";

strIDHeader.Length =34
this.Label4.Text.Length = 41

I keep getting "Index and length must refer to a location within the string. Parameter name: length"

It only works when I use real numbers instead of string.Length...

Help!


Start Free Trial
 
Loading Advertisement...
 
[+][-]11.30.2005 at 12:00PM PST, ID: 15391068

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: C# Programming Language
Tags: substring
Sign Up Now!
Solution Provided By: Zephyr__
Participating Experts: 1
Solution Grade: A
 
 
[+][-]11.30.2005 at 12:18PM PST, ID: 15391211

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.

 
[+][-]11.30.2005 at 12:29PM PST, ID: 15391302

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.

 
[+][-]11.30.2005 at 01:46PM PST, ID: 15391949

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.

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