I am new to C# and I am trying to understand the timer feature.. I made a label, a textbox and a button also added a timer ofcourse.
I have a int set to 1000 = 1 second.
I would like to be able to enter a value into the textbox i.e 5 and then the timer uses that as its interval between every tick.
For some reason its saying "Cannot implicitly convert type "string to int"
And I have no idea on how to convert a string to an int..
Any examples? Would help me so much!
namespace Clicker
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
int count = 0;
int interval = 1000;
private void Form1_Load(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
timer1.Start();
interval = textBox1.Text;
}
private void timer1_Tick(object sender, EventArgs e)
{
count++;
label1.Text = count.ToString();
}
}
}