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

  • Home
  • SEARCH
  • 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 6012005
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:20:29+00:00 2026-05-23T02:20:29+00:00

Starters: Here is the error that gets generated: Destination array was not long enough.

  • 0

Starters: Here is the error that gets generated:

Destination array was not long enough. Check destIndex and length, and the array’s lower bounds.

Code: C#, ASP.NET

Env: VS 2005

What I’m doing is using a BitArray to flip bits based on a certain condition of a TreeView. Right now I’m traversing a TreeView and if the node is checked from a child, I will flip an index in the BitArray. I have multiple TreeViews that I am traversing so I have multiple BitArrays. Once I get all the BitArrays populated, I will convert the bits to an integer value (encoded in a sense) and place them in an int array. Then the ultimate goal is to push the integer values to a database but obviously I can’t get that far. Sample code provided below:

        BitArray MTRTECH = new BitArray(8);
        BitArray MTRRD = new BitArray(200);
        BitArray REVSE = new BitArray(100);
        BitArray ETXA = new BitArray(100);
        int[] conversion = new int[11];


        ParentChildCheck(MTRTECHTreeView, MTRTECH);
        MTRTECH.CopyTo(conversion, 7);
        ParentChildCheck(MTRRDRTreeView, MTRRD);
        MTRRD.CopyTo(conversion, 8);  <================ Throws Error Here
        ParentChildCheck(REVSECTreeView, REVSE);
        REVSE.CopyTo(conversion, 9); 
        ParentChildCheck(EXTRATreeView, ETXA);
        ETXA.CopyTo(conversion, 10);



    protected void ParentChildCheck(TreeView parent, BitArray Changes)
    {
        TreeNode temp = new TreeNode();

        for (int index = 0; index < parent.Nodes.Count; index++)
        {
            temp = parent.Nodes[index];

            for (int index2 = 0; index2 < temp.ChildNodes.Count; index2++)
            {
                ChildCheck(temp.ChildNodes[index2],Changes,index2);
            }
        }

    }

    protected void ChildCheck(TreeNode node, BitArray Selection, int value)
    {
        message2 += node.Text;
        Selection.Set(value, true);
        counter++;

        for (int index = 0; index < node.ChildNodes.Count; index++)
        {
            value++;
            ChildCheck(node.ChildNodes[index],Selection,value);
        }
    }
  • 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-23T02:20:30+00:00Added an answer on May 23, 2026 at 2:20 am

    Your source BitArray MTRRD is internally stored as an array of 7 Int32s, your destination array conversion is an array of 11 Int32s. When you perform the copy you are specifying a index of 8, this index is an index into the destination array, so the copy will overrun because your desintation is not long enough to contain all 7 Int32s starting at index 8.

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

Sidebar

Related Questions

For starters, I am completely new to PHP. That being said, here's my problem.
Here's a starter list: if hbm is hand generated, is it an embedded resource?
Here's an easy one for you... perhaps. The SubSonic Starter Kit that is discussed
For starters, this question is not so much about programming in the NetBeans IDE
Ok, a few things I'm not quite sure about. For starters: I have a
For starters, here is my markup: <form action=/People/_Delete/AUG0003/10?searchType=IdentityCode&amp;Filter=a&amp;searchOption=StartsWith method=post onsubmit=return confirm(&#39;Are you sure you
Here is the subsonic asp.net mvc application http://subsonicproject.com/docs/MVC_Starter_Template but its for MVC 1.0. How
I'm a Facebook programmer newbie. Could anybody recommend good resources for starters? I believe
I'm creating a starter kit that installs the compiled assemblies from an open-source project
So here’s the challenge. Given 2 integers named a and b: // Find the

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.