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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T14:56:43+00:00 2026-06-13T14:56:43+00:00

I have this Scroll event of a trackBar: private void trackBar1_Scroll(object sender, EventArgs e)

  • 0

I have this Scroll event of a trackBar:

private void trackBar1_Scroll(object sender, EventArgs e)
        {

                trackbarCounter++;
                if (manualDone == true)
                {
                    myTrackPanelss1.trackBar1.Minimum = 0;
                    myTrackPanelss1.trackBar1.Maximum = _fi.Length - 1;                    setpicture(myTrackPanelss1.trackBar1.Value);
                    this.pictureBox1.Refresh();
                }
                if (automaticDone == true)
                {
                    myTrackPanelss1.trackBar1.Minimum = 0;
                    myTrackPanelss1.trackBar1.Maximum = fiAutomatic.Length - 1;
                    long[] tt = list_of_histograms[myTrackPanelss1.trackBar1.Value];
                    long res = GetTopLumAmount(tt, 1000);
                    long max = GetHistogramMaximum(tt);
                    GetHistogramAverage(tt);
                    setpicture(myTrackPanelss1.trackBar1.Value);
                    this.pictureBox1.Refresh();

                                    }

        }

The exception is on this line:

long[] tt = list_of_histograms[myTrackPanelss1.trackBar1.Value];

After im clicking on the trackBar and move it to the right in this case this time it went as far as to the frame/track 40 then throw the exception there.

The exception:

Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index

Now fiAutomatic variable contain 2225 indexs for example in index [0] i see: {000001.bmp}
In index [1] i see: {000002.bmp}
And so on.

list_of_histograms is a contain now 40 indexs in each index i have a 256 indexs inside for example in index[0] i see: {[long256]} and i see in index[0] 256 numbers.
Then in index[1] again {[long256]} and another 256 numbers and so on.

And the trackBar value is 40.

But why when im moving the trackBar to the right after 40 frames/images its throwing this exception ?

This is the full exception message:

System.ArgumentOutOfRangeException was unhandled
  Message=Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
  Source=mscorlib
  ParamName=index
  StackTrace:
       at System.ThrowHelper.ThrowArgumentOutOfRangeException()
       at System.Collections.Generic.List`1.get_Item(Int32 index)
       at Extracting_Frames.Form1.trackBar1_Scroll(Object sender, EventArgs e) in D:\C-Sharp\Extracting_Frames\Extracting_Frames\Extracting_Frames\Form1.cs:line 1793
       at System.Windows.Forms.TrackBar.OnScroll(EventArgs e)
       at System.Windows.Forms.TrackBar.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.SendMessage(HandleRef hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at System.Windows.Forms.Control.SendMessage(Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.Control.ReflectMessageInternal(IntPtr hWnd, Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.ScrollableControl.WmHScroll(Message& m)
       at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
       at System.Windows.Forms.UserControl.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.CallWindowProc(IntPtr wndProc, IntPtr hWnd, Int32 msg, IntPtr wParam, IntPtr lParam)
       at System.Windows.Forms.NativeWindow.DefWndProc(Message& m)
       at System.Windows.Forms.Control.DefWndProc(Message& m)
       at System.Windows.Forms.Control.WndProc(Message& m)
       at System.Windows.Forms.TrackBar.WndProc(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
       at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
       at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
       at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
       at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
       at System.Windows.Forms.Application.Run(Form mainForm)
       at Extracting_Frames.Program.Main() in D:\C-Sharp\Extracting_Frames\Extracting_Frames\Extracting_Frames\Program.cs:line 18
       at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.AppDomain.nExecuteAssembly(RuntimeAssembly assembly, String[] args)
       at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
       at System.Runtime.Hosting.ManifestRunner.ExecuteAsAssembly()
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext, String[] activationCustomData)
       at System.Runtime.Hosting.ApplicationActivator.CreateInstance(ActivationContext activationContext)
       at System.Activator.CreateInstance(ActivationContext activationContext)
       at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssemblyDebugInZone()
       at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
       at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
       at System.Threading.ThreadHelper.ThreadStart()
  InnerException: 
  • 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-13T14:56:45+00:00Added an answer on June 13, 2026 at 2:56 pm

    list_of_histograms is a contain now 40 indexs in each index

    This would be your problem. Remember that when you declare something, it indexes it from 0. So 40 indexes would mean it maxes out at 39. Doing list_of_histograms[40] is going to cause an error.

    EDIT: And NOW I notice the comment on your question when I go to retag it…

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

Sidebar

Related Questions

I have a DataGridView, and I'm listening to its Scroll event. This gives me
I have a scrolling div containing list items. I have this boilerplate scroll event
I have this function working <script type=text/javascript> $(window).scroll(function() { if ($(window).scrollTop() == $(document).height() -
i have a scroll view with multiple images and i am using this code.
I have defined a tag with a CSS attribute overflow set to scroll. This
So I've got this UpdatePanel. Inside it I have a nifty little jQuery scroll
I have a rather annoying cosmetic issue with jQuery. I'm using the $(window).scroll event
i created a custom Rich which has a scrollPos event. so i have this
I am building a website and in this website I have an event on
Currently I have this listener event on my google maps: google.maps.event.addListener(map, 'dragend', function() {

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.