Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
C#
public partical class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();
    }
      
    Int A;
    Int[] B = new int [360];
    
    private void timer1_Tick(object sender, EventArgs e)
    {
        A++;
        if ( A == 360 )
        {
            A = 0;
        }
        textbox1.text = A.ToString();
    }
}


What I have tried:

I want to store this 360 number in array.

Then B[2] - B[1].

Answer show in textbox.

How to do that.

My English language is very bad.
Posted
Updated 15-Nov-20 22:43pm
v3
Comments
Patrice T 14-Nov-20 0:47am    
Stole or store ?
OriginalGriff 14-Nov-20 2:06am    
Well, he nicked the idea from his teacher ... :laugh:

1 solution

There is no array to store it in, nor does it make any sense to store each different value you generate in an array and subtract them, because with one exception (when the value changes from 360 to zero) the value you stored in the textbox will always be 1.

I think you need to go back to your original assignment, and re-read it rather more carefully - what you are asking for does not make any sense at all!

BTW: you can improve this code:
C#
A++;
if ( A == 360 )
    {
    A = 0;
    }
To a single line:
C#
A = ++A % 360;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900