title: how to get month wise data in datagridview with local datatable in c#
body: <pre><code>public partial class logRead : Form
  {
      DataSet ds = new DataSet();
      DataTable tab = new DataTable();
  
      public logRead()
      {
          InitializeComponent();
      }
      string line;
      private void BtnUser_Click(object sender, EventArgs e)
      {           
          DataRow[] filteredRows = tab.Select("Username = '"+cmbUsername.Text+"'");
          DataTable dt = filteredRows.CopyToDataTable();
          dgv1.DataSource = dt;
          txtcount.Text = dgv1.Rows.Count.ToString();         
      }
  
      private void btnsearch_Click(object sender, EventArgs e)
      {
          dtmDate.CustomFormat = "dd MMM yyyy hh mm ss";
          DataRow[] filteredRows = tab.Select("Datetime = '" +dtmDate.Text + "'");
           DataTable dt = filteredRows.CopyToDataTable();
          dgv1.DataSource = dt;                   
      }
  
      private void logRead_Load(object sender, EventArgs e)
      {
          StreamReader strRead = new StreamReader("D:\\login.hml");
          string line;
          line = strRead.ReadToEnd();
          DataRow row = null;
          tab.Columns.Add("Ipaddress");
          tab.Columns.Add("Sysname");
          tab.Columns.Add("Username");
          tab.Columns.Add("Text");
          tab.Columns.Add("Datetime");
          string[] rows = line.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
          foreach (string r in rows)
          {
              string[] columns = r.Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries);
              if (columns.Length &lt;= tab.Columns.Count)
              {
                  row = tab.NewRow();
  
                  for (int i = 0; i &lt; columns.Length; i++)
  
                      row[i] = columns[i];
                  tab.Rows.Add(row);
              }
          }
          ds.Tables.Add(tab);
          dgv1.DataSource = ds.Tables[0];
          txtcount.Text = dgv1.Rows.Count.ToString();
      }
  }}
  </code></pre>
  
  <p>i have alogfile ,when form load itself i  write code to fill datagridview ,i use temporarly datatable and dataset and filling in to datagridview ,and i use combobox to fill all user names  temporarly and if i click any name on combobox what are all names that information fill in datagridview i write that code in btn userclik now i want log table by month wise or date i taken two comboboxess and one combox fill datetime picker and one more months i fill ,now i want to click and month i want to show month wise dat in datagridview ,i write that  code search click i am not getting.(dis is in windows forms)one more thng i am not using database also,plz check the code.</p>