Hello

I'm afraid I am back again with more questions regarding converting VB.Net to C# in a ASP.Net application I am making.

Trying to convert the following:

VB Code:
  1. Dim m As String = Request.QueryString("month")
  2.         Dim y As String = Request.QueryString("year")
  3.  
  4.         If m Is Nothing Then m = Now.Month.ToString()
  5.         If y Is Nothing Then y = Now.Year.ToString()
  6.  
  7.         Dim dt As New Date(y, m, 1)
  8.         litTitle.Text = dt.ToString("MMMM yyy")

I can convert everything to C# without any problem, however, when trying to use the New Date, the equivalent of which in C# I have found to be new DateTime, it only excepts int as pararmeters to pass to the constructor, not string, and I cannot find a way to convert from a string to an int!

Any thoughts?

Here is what I have so far:

VB Code:
  1. string m = Request.QueryString["month"];
  2.         string y = Request.QueryString["year"];
  3.  
  4.         if (m == null)
  5.             m = DateTime.Now.Month.ToString();
  6.         if (y == null)
  7.             y = DateTime.Now.Year.ToString();
  8.  
  9.         DateTime dt = new DateTime(y,m,1);    <--- This is where I get the error!!!
  10.         litTitle.Text = dt.ToString("MMMM yyy") + " Entries";

Cheers

Gary