Bocens
Bocens
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
Thanks for the help
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
Thank you very much, it is possible to know exactly why my code was not liked, although it works the same.
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
I created the code:
int x1, y1, k1,
x2, y2, k2 = 0;

int i = 0;


x1 = int.TryParse(this.x1.Text, out i) ? Convert.ToInt32(this.x1.Text) : 0;
y1 = int.TryParse(this.y1.Text, out i) ? Convert.ToInt32(this.y1.Text) : 0;
k1 = int.TryParse(this.k1.Text, out i) ? Convert.ToInt32(this.k1.Text) : 0;

x2 = int.TryParse(this.x2.Text, out i) ? Convert.ToInt32(this.x2.Text) : 0;
y2 = int.TryParse(this.y2.Text, out i) ? Convert.ToInt32(this.y2.Text) : 0;
k2 = int.TryParse(this.k2.Text, out i) ? Convert.ToInt32(this.k2.Text) : 0;

Console.WriteLine("x1: " + x1);
Console.WriteLine("y1: " + y1);
Console.WriteLine("k1: " + k1);
Console.WriteLine("x2: " + x2);
Console.WriteLine("y2: " + y2);
Console.WriteLine("k2: " + k2);




decimal trezultatas = (x1 * y1) * k1;
decimal trezultatas2 = (x2 * y2) * k2;

decimal rezultatas = trezultatas / 1000000;
decimal rezultatas2 = trezultatas2 / 1000000;

decimal brezultatas = rezultatas + rezultatas2;

Console.WriteLine("trez: " + trezultatas);
Console.WriteLine("rez :" + brezultatas);

label8.Text = brezultatas.ToString("0.00 m\u00b2");
int x1, y1, k1,
x2, y2, k2 = 0;

int i = 0;


x1 = int.TryParse(this.x1.Text, out i) ? Convert.ToInt32(this.x1.Text) : 0;
y1 = int.TryParse(this.y1.Text, out i) ? Convert.ToInt32(this.y1.Text) : 0;
k1 = int.TryParse(this.k1.Text, out i) ? Convert.ToInt32(this.k1.Text) : 0;

x2 = int.TryParse(this.x2.Text, out i) ? Convert.ToInt32(this.x2.Text) : 0;
y2 = int.TryParse(this.y2.Text, out i) ? Convert.ToInt32(this.y2.Text) : 0;
k2 = int.TryParse(this.k2.Text, out i) ? Convert.ToInt32(this.k2.Text) : 0;

Console.WriteLine("x1: " + x1);
Console.WriteLine("y1: " + y1);
Console.WriteLine("k1: " + k1);
Console.WriteLine("x2: " + x2);
Console.WriteLine("y2: " + y2);
Console.WriteLine("k2: " + k2);




decimal trezultatas = (x1 * y1) * k1;
decimal trezultatas2 = (x2 * y2) * k2;

decimal rezultatas = trezultatas / 1000000;
decimal rezultatas2 = trezultatas2 / 1000000;

decimal brezultatas = rezultatas + rezultatas2;

Console.WriteLine("trez: " + trezultatas);
Console.WriteLine("rez :" + brezultatas);

label8.Text = brezultatas.ToString("0.00 m\u00b2");
Is this a logical code? Because everything works, now i can empty fields
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
How to upload the code here neatly?
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
Ok, I will try this option in the evening
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
I have a code 'int x1 = Convert.ToInt32(this.TextBox1.Text); int y1 = Convert.ToInt32(this.TextBox2.Text); int k1 = Convert.ToInt32(this.TextBox3.Text); int x2 = Convert.ToInt32(this.TextBox4.Text); int y2 = Convert.ToInt32(this.TextBox5.Text); int k2 = Convert.ToInt32(this.TextBox6.Text); int sum = (x1y1)k1; suma.Text = sum.ToString();' I want empty fields x2, y2, k2, but the program does not allow me to ignore them
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
As an example, I want to make such a program, there is no problem with empty cells in excel, but in winform, empty fields are not allowed
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
When I'm at home I'll try to post a code of how I'm doing
34 replies
CC#
Created by Bocens on 4/24/2023 in #help
✅ TextBox problem.
yes, does not handle empty strings
34 replies