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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:11:48+00:00 2026-05-29T10:11:48+00:00

For example i have a long[] x And im doing: for (int i=0; i<x.length;x–)

  • 0

For example i have a long[] x
And im doing:

for (int i=0; i<x.length;x--)
{
}

I know that in x for example i have 30 indexs cells.
How can i loop over the cells(indexs) in the x array and find on each cell the length of it and also to get/show the numbers in each cell.

If in x[0] there is 232
And in x[1] there is 21
And so on…

I want to display 232,21,….etc
And then i want to check that if x[i].length is above 0 do…
But there is no x[i].length

So how do i do it ?


I did:

public long GetHistogramMaximum(long[] histogram)
        {
            long result = 0;
            long count = 0;

            for (int i = 0; i < histogram.Length; i++)
            {
                if (histogram[i] > 0)
                {
                    MessageBox.Show(histogram[i].ToString());
                    break;
                }

            }

            return result;




        }

And its working but each time its showing me the number twice why the messagebox is working twice each time ?
If in the first array the number is 33454 then i see the messagebox once and then once again. Whats wrong here ? I want it to show me the number only once each time.

Its like repeating each number and show it once and then once again and only then moving to the next one.

EDIT **

Maybe the problem its showing the number twice each time have something to do with the scroll event im using ?

void trackBar1_Scroll(object sender, EventArgs e)
        {
            myTrackPanelss1.trackBar1.Minimum = 0;
            myTrackPanelss1.trackBar1.Maximum = counter - 1;//list_of_histograms.Count-1;
            long[] tt = list_of_histograms[myTrackPanelss1.trackBar1.Value];
            histogramControl1.DrawHistogram(tt);
            long res = GetTopLumAmount(tt, 1000);
            long max = GetHistogramMaximum(tt);
            if (res > -1)
            label24.Text = (res / 1000.0).ToString();
            setpicture(myTrackPanelss1.trackBar1.Value);
            this.pictureBox1.Refresh();
        }

For some reason its getting to the scroll and do everything here again. Twice in a row.
What can be the problem ?

  • 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-29T10:11:49+00:00Added an answer on May 29, 2026 at 10:11 am

    A long[] basically holds a number of long values. Doing x[i].length is invalid, because a long does not have a property length. What is it that you are trying to achieve?

    long[] x = {1,2,3} ;
    x.length; //this is valid because you are querying the length / count of the array
    x[0].length; //this is invalid because 1 does not have a property length
    

    EDIT

    Your loop counter will be the index. So,

    for (int i =0; i < x.Length; i++)
    {
       //check for maximum, when you find it
       Console.WriteLine("The maximum value is " + x[i]);
       Console.WriteLine("The maximum value is present at index " + i);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Case example: I have a long list of items, and when I put my
If I for example have <p> some long text </p> on my HTML page,
Here's the problem. I ,for example,have a string 2500.Its converted from byte array into
Example: I have an class that inherits from UIImageView. An object creates an instance
I'm working with some binary data that I have stored in arbitrarily long arrays
I have been using for a long time a C function that calculates the
I have created a test service with a method that contains a very long
I have a table with the following columns (of urls): [id,url,visited,timestamp] Types:[int,string,int,long] I want
I have this code: public void replay() { long previous = DateTime.Now.Ticks; for (int
Perhaps I have been doing Flex development with Frameworks like Cairngorm too long but

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.