IndexOutofRangeException Winform
-
12-11-2019 - |
Question
What's wrong with my code??
string birthdate = ((DataRowView)comboBox1.SelectedItem).Row["birthdate"].ToString(); //pulled the data into the database ()
string[] split = birthdate.Split('/'); //split the Date
I want to put them in a textbox so I thought of doing this:
textbox1.Text = split[0]; //correct, gets the 1st word the (Day)
textbox2.Text = split[1]; //incorrect, outofrange exception (Month)
textbox3.Text = split[2]; //incorrect, outforange exception (Year)
NOTE: The format is Day/Month(words)/Year ==> 1/January/2012
Can somebody help me get that values and put them one by one in a textbox?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow