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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:55:53+00:00 2026-05-26T08:55:53+00:00

How can I pass an array of integer from a button to another one?

  • 0

How can I pass an array of integer from a button to another one?

Here is more information (the following code is not exactly my original code, but it explains what I’m asking):

private void button1_Click(object sender, EventArgs e)
{
    int[,] array1 = new int[pictureBox1.Height, pictureBox1.Width];
    int[,] array2 = new int[pictureBox1.Height, pictureBox1.Width];

    array2 = binary(array1);//binary is a function
}

private void button2_Click(object sender, EventArgs e)
{
   //I need array2 here
}

Now I want to access array2 in button2. How can I do that? What is the best solution?

Thanks in advance.

  • 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-26T08:55:54+00:00Added an answer on May 26, 2026 at 8:55 am

    Looks like whilst first button click you are prepare some data and whilst second button click you are going to use it some how.

    You can share an array using class-level variable:

    class YourClass
    {
      private int[,] data;
    
      private void button1_Click(object sender, EventArgs e) 
      {
        this.data = new ...
      }
    
      private void button2_Click(object sender, EventArgs e)
      {
        // process a data
        if (this.data != null)
        {
           this.data ...
        }
      }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My current code looks like the following. How can I pass my array to
From a method, I can pass a struct which contains an array of integers,
I want to pass an integer array from input parameters of my postgresql function
How can I pass an array of structs by reference in C? As an
In C can I pass a multidimensional array to a function as a single
Can i pass the entire POST array into a function and handle it within
I have an array which contains around 50-200 hyperlinks. How can I pass this
I have the following program. However, I can't understand why I have to pass
The problem can be found in the following code: def debug[T](format: String, arg1:T, arg2:Any,
I can pass a variable from MVC ASP.NET by using this : var lastCategoryId

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.