Piszę sobie program w c#, i nie wiem dlaczego ale nie mogę (po uruchomieniu programu) do texboxa wpisać więcej niż jeden znak, ktoś wie co może być przyczyną?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TemperatureConverter
{
public partial class main_window : Form
{
public main_window()
{
InitializeComponent();
}
private void celsjus_Box1_TextChanged(object sender, EventArgs e)
{
// if ()
{
kelvin_textBox2.Text = "alksd";
try
{
double value = Convert.ToDouble(celsjus_Box1.Text);
kelvin_textBox2.Text = Convert.ToString(value + 273.15);
ferenheit_textBox3.Text = Convert.ToString(value + 1);
}
catch (FormatException)
{
Console.WriteLine("Unable to convert '{0}' to a Double.");
}
catch (OverflowException)
{
Console.WriteLine("'{0}' is outside the range of a Double.");
}
}
}
private void celsjus_Box1_TextChanged(object sender, KeyPressEventArgs e)
{
try
{
double value = Convert.ToDouble(celsjus_Box1.Text);
kelvin_textBox2.Text = Convert.ToString(value + 273.15);
ferenheit_textBox3.Text = Convert.ToString(value + 1);
}
catch (FormatException)
{
Console.WriteLine("Unable to convert '{0}' to a Double.");
}
catch (OverflowException)
{
Console.WriteLine("'{0}' is outside the range of a Double.");
}
celsjus_Box1.Clear();
}
}
}