Windows Forms Datagrid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Bernardo

    #1

    Windows Forms Datagrid

    Hi,

    I want to have a grid whith only one field updatable (a
    checkbox), but if I put the grid ReadOnly I can't change
    the field, and if I put the grid ReadOnly = false a new
    record line appears.
    There is any way to don't display the new record line and
    let just one field to be editable?

    There is any way to now by mouseMove event if I'm moving
    the mouse over a specified field?

    Thanks a lot

  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: Windows Forms Datagrid

    > There is any way to don't display the new record line and[color=blue]
    > let just one field to be editable?[/color]

    1. You can make certain columns read-only by employing such classes as
    DataGridTableSt yle and DataGridColumnS tyle.
    2. You can suppress the "add new" row with the following code (should be run
    right after the grid has been bound to data):

    CurrencyManager cm = (CurrencyManage r)this.BindingC ontext[grid.DataSource ,
    grid.DataMember];
    DataView view = (DataView)cm.Li st;
    view.AllowNew = false;
    [color=blue]
    > There is any way to now by mouseMove event if I'm moving
    > the mouse over a specified field?[/color]

    You can use the grid's HitTest method to determine which part of the grid is
    currently under the mouse pointer.

    --
    Dmitriy Lapshin [C# / .NET MVP]
    X-Unity Test Studio

    Bring the power of unit testing to VS .NET IDE

    "Bernardo" <bernardoantoni o.piano@eds.com > wrote in message
    news:064a01c3c4 c5$ae07e420$a60 1280a@phx.gbl.. .[color=blue]
    > Hi,
    >
    > I want to have a grid whith only one field updatable (a
    > checkbox), but if I put the grid ReadOnly I can't change
    > the field, and if I put the grid ReadOnly = false a new
    > record line appears.
    > There is any way to don't display the new record line and
    > let just one field to be editable?
    >
    > There is any way to now by mouseMove event if I'm moving
    > the mouse over a specified field?
    >
    > Thanks a lot
    >[/color]

    Comment

    Working...