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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T07:08:00+00:00 2026-06-18T07:08:00+00:00

I have the following array: int[] month = new int[12] { 1, 2, 3,

  • 0

I have the following array:

int[] month = new int[12] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };

This represents my months in a year.

Now I have two buttons, and a label. The label should only display the value of the current item in the array. When I press, lets say, the next button, It should move from eg. 5 to 6 in the array, and now display 6 in the label.

  • 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-18T07:08:01+00:00Added an answer on June 18, 2026 at 7:08 am

    Try the below code it will help you…

    Set this array as Global

    int[] month = new int[12] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 };
    

    Load event

    label1.Text = month[4].ToString();
    

    Next Button Click

            int ind = Array.IndexOf<int>(month, Convert.ToInt32(label1.Text));
            if ((ind + 1) != 12)
                label1.Text = month[ind + 1].ToString();
            else
                MessageBox.Show("End of the Array element");
    

    Previous button Click

                int ind = Array.IndexOf<int>(month, Convert.ToInt32(label1.Text));
                if ((ind - 1) != -1)
                    label1.Text = month[ind - 1].ToString();
                else
                    MessageBox.Show("End of the Array element");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following two dimensional array: static int[,] arr = new int[5, 5]
I have the following array of integers: int[] array = new int[7] { 1,
I have to copy the following int array in to Array : int[] intArray=new
I have the following array: int* myArray = new int[45]; If I wanted to
I have the following array: private int[,] testSamples = new testSamples[101,101]; It's supposed to
If i have the following: class Array{ public: Array (int n=2) : _n(n), buf(new
Lets say I have an array numbers that contains the following values: int numbers
I have the following array(in python): arr= ['\n', ' a#B\n', ' c#D\n'] Now I
For example, we have the following array: char data[]=new char[]{'A','S','O','R','T','I','N','G','E','X','A','M','P','L','E'}; and an index array:
i have the following array: [addToCart]=> array(3) { [1]=> array(5) { [aantal]=> int(1) [film_id]=>

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.