コード例 #1
0
        //private void VSCellEnter(object sender, DataGridViewCellEventArgs e)
        //{
        //    if (CurrentCell.ReadOnly && e.ColumnIndex < Columns.Count - 1)
        //    {
        //        SendKeys.Send("{RIGHT}");
        //    }
        //}


        //eventhandler
        private void mNavigationBar_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
        {
            switch (e.ClickedItem.Name)
            {
            case "btnNext":
                if (Page < NumPages)
                {
                    Page++;
                    Navigate();
                }
                break;

            case "btnPrev":
                if (Page > 1)
                {
                    Page--;
                    Navigate();
                }
                break;

            case "btnFirst":
                Page = 1;
                Navigate();
                break;

            case "btnLast":
                Page = NumPages;
                Navigate();
                break;
            }
            mNavigationBar.Items["Counter"].Text = Page.ToString() + "/" + NumPages.ToString();
            return;
        }
コード例 #2
0
        //public void AddPK(string pDBParameter,pDBFieldName)
        //{
        //    VSPrimaryKey.Add(pDBParameter,pPK);
        //    mDA.AddParameter(pDBParameter,pPK);
        //}
        public void UpdateEspackControl()
        {
            string lSql;
            int    mNumRecords = 0;

            Page = 1;
            //mDA.SelectRS=new DynamicRS();
            mDA.SelectRS.DS.Dispose();
            DataSource = null;
            if (Paginate)
            {
                mDA.Open((Page - 1) * mPageSize, mPageSize);
                lSql = "SELECT NumRecords=count(*) FROM " + CtlQuery.Tablename.DBItemName + " WHERE " + CtlQuery.WhereString;
                DynamicRS lRS = (DynamicRS) new DynamicRS(lSql, Conn);
                foreach (CtlVSColumn lColumn in ColumnsExternalKeys)
                {
                    lRS.AddControlParameter(lColumn.Name, lColumn.LinkedControl);
                }
                lRS.Open();
                mNumRecords            = Convert.ToInt32(lRS["NumRecords"]);
                NumPages               = mNumRecords / mPageSize + ((mNumRecords % mPageSize) == 0 ? 0 : 1);
                mNavigationBar.Enabled = NumPages > 1;
                mNavigationBar.Items["Counter"].Text = "1/" + NumPages.ToString();
            }
            else
            {
                mDA.Open();
            }
            DataSource = mDA.Table;
            Refresh();
            Status = mStatus;
        }
        /// <summary>
        /// Get the last page of the list
        /// </summary>
        /// <returns>The last page of the list</returns>
        private int GetMaxPage()
        {
            // Get the max page by returning the number after the '/'
            // This assumes that there is only one '/' in the string and that the max page is the number after it
            var split = NumPages.WaitRetry(_driver).Text.Split('/');

            return(Int32.Parse(split[1].Trim()));;
        }