1 Replies - 1701 Views - Last Post: 19 March 2014 - 04:43 PM Rate Topic: -----

#1 roipatrick  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 19-March 14

Hide row if column 4 or very row is (date < datenow

Posted 19 March 2014 - 10:45 AM

I only wanted to hide a row if startdate column of that row has this statement (startdate < presentdate). It deleted but only 1 row and I want to delete all rows if they have the statement (dtartdate < presentdate) is satisfied. But i always come accross errors. Please help me guys....I need this one desparately. Thank you in advance and i apologize for my english.
void LoadSource()
        {
            //string dateInString = Convert.ToString(Convert.ToDateTime(_dr[4]));
            //string dateInString = Convert.ToString(Convert.ToDateTime(RaDate));
            
            //DateTime startdate = DateTime.Parse(dateInString);
            //DateTime datelimit = startdate.AddDays(90);
            //int counter = 0;
            _fd = new FinancialData();
            if (cboType.SelectedIndex == 0) //&& DateTime.Now > datelimit)
                        grdDetails.DataSource = _fd.RetrievePayments();
            DataTable _dtPayment = _fd.RetrievePayments();
            if (grdDetails.DataSource == null)
            {
                MessageBox.Show("sample");
            }
            else
            {
                MessageBox.Show("smple");
            }
            string item = grdDetails[grdDetails.CurrentCell.ColumnIndex,
grdDetails.CurrentCell.RowIndex].Value.ToString();
            if (item != null)
            {
                int di = 0;
                int id = Convert.ToInt32(grdDetails[di, grdDetails.CurrentCell.RowIndex].Value);
                foreach (DataRow _dr in _dtPayment.Rows)
                {
                    var now = DateTime.Now;
                    if (DateTime.Parse(_dr[4].ToString()) < now)
                    {
                        this.grdDetails.Rows[id].Visible = false;
                    }
                    id++;
                    di++;
                }
            }
            
            MessageBox.Show(grdDetails.DataSource);
            else if (cboType.SelectedIndex == 1)// && DateTime.Now > datelimit)
                grdDetails.DataSource = _fd.RetrieveRemittanceAdvices();
            else
                grdDetails.DataSource = null;
        
        }


or if you can rephrase my whole code then thank you....Please help me guys...

This post has been edited by modi123_1: 19 March 2014 - 10:49 AM
Reason for edit:: please use the code tags button


Is This A Good Question/Topic? 0
  • +

Replies To: Hide row if column 4 or very row is (date < datenow

#2 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 3479
  • View blog
  • Posts: 10,725
  • Joined: 05-May 12

Re: Hide row if column 4 or very row is (date < datenow

Posted 19 March 2014 - 04:43 PM

View Postroipatrick, on 19 March 2014 - 01:45 PM, said:

But i always come accross errors.

What error are you getting?
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1