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 8782247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T20:31:20+00:00 2026-06-13T20:31:20+00:00

I have just run across a problem which is common but I’m not sure

  • 0

I have just run across a problem which is common but I’m not sure why it’s happening in this instance.

string s;
int c1, c2, c3, c4;    

private void button2_Click(object sender, EventArgs e)
{
    String number;
    s = textBox1.Text;
    int[] d = s.Select(c => (int)c - (int)'0').ToArray();

    try
    {
        c1 = (4 * d[1] + 10 * d[2] + 9 * d[3] + 2 * d[4] + d[5] + 7 * d[6]) % 11;
        c2 = (7 * d[1] + 8 * d[2] + 7 * d[3] + d[4] + 9 * d[5] + 6 * d[6]) % 11;
        c3 = (9 * d[1] + d[2] + 7 * d[3] + 8 * d[4] + 7 * d[5] + 7 * d[6]) % 11;
        c4 = (d[1] + 2 * d[2] + 9 * d[3] + 10 * d[4] + 4 * d[5] + d[6]) % 11;
    }
    catch (Exception ex)
    {
        MessageBox.Show(ex.Message);
    }

    number = d[1]+d[2]+d[3]+d[4]+d[5]+d[6]+c1+c2+c3+c4.ToString();
    textBox2.Text = number;    
}

It will accept the number in the first TextBox(es) fine. As soon as it moves onto the catch section it will pop up with an error Index was outside the bounds of the array Is there something obvious I’m missing? or is this quite unique to my program?

  • 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-06-13T20:31:22+00:00Added an answer on June 13, 2026 at 8:31 pm

    I bellieve that you think your array goes from 1 to 6.
    Its from 0 to 5.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a little new to objective-C but have run across a problem that I
I have a Linode (Ubuntu 9.10, but upgrading not a problem) where I run
I am teaching myself some Python and I have come across a problem which
I've just started learning Java and have come across a little quirk I'm not
Just came across a problem while updating an existing app to iOS 6. in
once in a while I run across a problem with provisioning a device with
I've come across a weird problem which I can't solve, no matter what i
I have come across a problem that I don't know how to resolve involving
I just came across an interesting problem with a procedure I am writing in
I'm playing around with adverbs and conjunctions in J, and have run across a

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.