Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6975603
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T17:23:22+00:00 2026-05-27T17:23:22+00:00

I keep getting this error in my app small snippet of how simple this

  • 0

I keep getting this error in my app
small snippet of how simple this code is suppose to work

String lang = "Language.en-US".ToString();
appPath.Text = lang.Substring(2, lang.Length);//

Error

System.ArgumentOutOfRangeException: 
Index and length must refer to a location within the string

i get an error each time i change the start index but if i set it to 0 it works but i can’t change the start index to a higher number than zero is there anything i can download like an update to fix this Im sure it my system thats wrong im using .Net 4.0.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T17:23:22+00:00Added an answer on May 27, 2026 at 5:23 pm

    You should change it to

    appPath.Text = lang.Substring(2, lang.Length - 2);
    

    Basically according to the Substring method documenation

    public string Substring(
        int startIndex,
        int length
    )
    

    startIndex + length should be less than the string length.

    If you always want to get the string from second position to the very end you should use the overloaded version of Substring that is

    public string Substring(
        int startIndex
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I keep getting this error when I run my web app (asp.net mvc) in
I keep getting this error System.Web.HttpException was unhandled by user code Message=Validation of viewstate
I keep getting this error when I try to call Find() public void findTxt(string
I keep getting this error whenever I call gethostbyname() in my C code. ==7983==
I keep getting this error while trying to modify some tables. Here's my code:
I keep getting this error compile error /Users/dean/src/carolian/app/views/layouts/events.html.erb:10: syntax error, unexpected ',', expecting ')'
I have a rails application and i keep getting this error /srv/projects/app/controllers/application_controller.rb:174: invalid multibyte
I keep getting this error after my code has run between 5-10 min CallbackOnCollectedDelegate
Keep getting this error after inserting a subdatasheet into a query and trying to
I keep getting this error when I try to commit a group of executed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.