Quantcast
Channel: Silverlight 5 forum
Viewing all articles
Browse latest Browse all 1083

help error String was not recognized as a valid DateTime. after process and yes i searched but the sol don't work

$
0
0

          private void button1_Click(object sender, RoutedEventArgs e)
        {
            if (textBox1.Text.Length > 2)
            {
                string str = textBox1.Text;
                string[] splitstr = str.Split(' ');
                textBox1.Text = splitstr[0].ToString() + ":" + splitstr[1].ToString();
                textBox1.Focus();
                string asa = dateTimeBox1.SelectedDate.ToString();
                string[] splitasa = asa.Split(' ');
                string teste = splitasa[0].ToString()+ " " + textBox1.Text;
                DateTime? asd2 = dateTimeBox1.SelectedDate;
                textBox1.Text = teste;
                DateTime? asd = DateTime.ParseExact(teste, "yyyy-MM-dd HH:mm", CultureInfo.InvariantCulture);
                dateTimeBox1.SelectedDate = asd;
            }

Viewing all articles
Browse latest Browse all 1083