using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using Telerik.WinControls;

namespace MemoryTest
{
    public partial class frmSales : Telerik.WinControls.UI.RadForm
    {
        public frmSales()
        {
            InitializeComponent();
        } 
      
        public void ClearMem2()
        {
            try
            {
      
                contextMenuStrip1.Dispose();
                //rgbBillingAddress.DataBindings = null;
                dgvDetails.DataSource = null;
                dgvDetails = null;
                dgvAdjustment.DataSource = null;
                dgvAdjustment = null;
                dgvGiftCardDetails.DataSource = null;
                dgvGiftCardDetails = null;
                rgvReference.DataSource = null;
                rgvReference = null;
                dgvGodownDetails.DataSource = null;
                dgvGodownDetails = null;
                dgvReturn.DataSource = null;
                dgvReturn = null;

                rddlAccntType.DataSource = null;
                rddlAccntType = null;
             

                rcpUtilities = null;
                //rddlCard.DataSource = null;
                //rddlCard = null;
                rmccbCardAccount.DataSource = null;
                rmccbCardAccount = null;
                //rddlCheque.DataSource = null;
                //rddlCheque = null;
                rmccbChequeAccount.DataSource = null;
                rmccbChequeAccount = null;
                //rddlBnkTrnsfr.DataSource = null;
                //rddlBnkTrnsfr = null;
                rmccbBnkTrnfrAcc.DataSource = null;
                rmccbBnkTrnfrAcc = null;
                rddlDMPrintDesign.DataSource = null;
                rddlDMPrintDesign = null;
               
                foreach (Control cntrl in this.Controls)
                {
                    if (cntrl != null)
                        cntrl.Dispose();
                }

                //

                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

        }
        
    }
}
