if you need to get month from textbox with format like "yyyy-MM"
textBox1.Text = DateTime.Now.ToString("yyyy-MM");
DateTime dt =DateTime.ParseExact(textBox1.Text, "yyyy-MM", System.Globalization.CultureInfo.InvariantCulture);
string month = dt.Month.ToString();
References
DateTime.ParseExact Method[
^]
DateTime.Month Property[
^]
Or if you need to set textbox text to current month, try with
Month
property of
DateTime
textBox1.Text = DateTime.Now.Month.ToString();
C# DateTime.Month[
^]