Dev获取GridView的焦点行号为负数

wohuihenkuaile 2016-06-19 01:56:09



 //修改仓库
private void EditWareHouse_Click(object sender, EventArgs e)
{
try
{
MessageBox.Show(gridView1.FocusedRowHandle.ToString()); //获取到的焦点总为负数
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
...全文
349 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
圣殿骑士18 2016-06-19
  • 打赏
  • 举报
回复
大的负数值,是预定义行
 // 摘要:
    //     The grid control.
    [ComplexBindingProperties("DataSource", "DataMember")]
    [DataAccessMetadata("All", SupportedProcessingModes = "All")]
    [Description("A data-aware control that displays data in one of several views, enables editing data, provides data filtering, sorting, grouping and summary calculation features.")]
    [Designer("DevExpress.XtraGrid.Design.GridControlDesigner, DevExpress.XtraGrid.v14.2.Design", typeof(IDesigner))]
    [Docking(DockingBehavior.Ask)]
    [DXToolboxItem(true)]
    [LicenseProvider(typeof(DXWinLicenseProvider))]
    [ToolboxTabName("DX.14.2: Data & Analytics")]
    public class GridControl : EditorContainer, IPrintableEx, IPrintable, IBasePrintable, IPrintHeaderFooter, INavigatableControl, IToolTipControlClient, ISupportLookAndFeel, IDXManagerPopupMenu, IViewController, IFilteredComponent, IFilteredComponentBase, IBoundControl, ISupportXtraSerializer, IGestureClient, IGuideDescription, IFilteredComponentColumnsClient, ISearchControlClient, IFilteredComponentColumns, ILogicalOwner
    {
        // 摘要:
        //     Contains a value which represents the handle of the Auto Filter Row. For
        //     more information on row handles refer to the Identifying Rows and Cards section.
        //
        // 返回结果:
        //     $
        public const int AutoFilterRowHandle = -2147483646;
        //
        // 摘要:
        //     Contains the value representing the invalid row handle. This value is returned
        //     when an attempt to obtain a particular row fails, etc. Please refer to the
        //     Identifying Rows and Cards topic for more information regarding row handles.
        //
        // 返回结果:
        //     $
        public const int InvalidRowHandle = -2147483648;
        //
        // 摘要:
        //     Contains a value which represents the handle of the New Item Row/Card. For
        //     more information on row handles refer to the Identifying Rows and Cards section.
        //
        // 返回结果:
        //     $
        public const int NewItemRowHandle = -2147483647;

        // 摘要:
        //     Creates a new DevExpress.XtraGrid.GridControl control.
        public GridControl();
qq_35296629 2016-06-19
  • 打赏
  • 举报
回复
dataGridView1.CurrentRow.Index;我一般用这个获取选中行

110,533

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧