I try to make this: static private long number = (long)Math.Floor(GlobalRandom.NextDouble * 9_000_000_000L) + 1_000_000_000L;
to be returned with this:
public string MyValtwo
{
get { return myValtwo; }
set { myValtwo = value; }
}
and finally to be sent to this:
private void button1_Click(object sender, EventArgs e)
{
MyValtwo = textBox2.Text;
}
I tried converting: public string MyValtwo = Convert.ToString(number);
but nothing returns or the long (number) can't be converted into string.
The main idea is to be generated a number and automatically putted in form 1 text box
You dont need MyValtwo
. Change code to below and it will work:
private void button1_Click(object sender, EventArgs e)
{
textBox2.Text = number.ToString();
}
In case you want to store the value of number
as text in MyValtwo
then you can add below line in button1_Click
function.
MyValtwo = number.ToString();
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.