question about datagrid(WinForm)

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

    question about datagrid(WinForm)

    How can I avoid datagrid to add a new record.
    Only allow datagrid to edit old record.

    Thank,


  • Dmitriy Lapshin [C# / .NET MVP]

    #2
    Re: question about datagrid(WinFor m)

    Hi,

    After you've bound the grid to the data source, do the following:

    CurrencyManager cm = this.BindingCon text[theGrid.DataSou rce,
    theGrid.DataMem ber].List as CurrencyManager ;
    DataView view = (DataView)cm.Li st;
    view.AllowNew = false;

    --
    Sincerely,
    Dmitriy Lapshin [C# / .NET MVP]
    Bring the power of unit testing to the VS .NET IDE today!


    "Fox" <fox> wrote in message news:%23Vz58zXG FHA.3608@TK2MSF TNGP14.phx.gbl. ..[color=blue]
    > How can I avoid datagrid to add a new record.
    > Only allow datagrid to edit old record.
    >
    > Thank,
    >
    >[/color]

    Comment

    • Fox

      #3
      Re: question about datagrid(WinFor m)

      It's work, Thank you very much.
      "Dmitriy Lapshin [C# / .NET MVP]" <x-code@no-spam-please.hotpop.c om>
      ???????:%23kju6 4ZGFHA.3244@TK2 MSFTNGP15.phx.g bl...[color=blue]
      > Hi,
      >
      > After you've bound the grid to the data source, do the following:
      >
      > CurrencyManager cm = this.BindingCon text[theGrid.DataSou rce,
      > theGrid.DataMem ber].List as CurrencyManager ;
      > DataView view = (DataView)cm.Li st;
      > view.AllowNew = false;
      >
      > --
      > Sincerely,
      > Dmitriy Lapshin [C# / .NET MVP]
      > Bring the power of unit testing to the VS .NET IDE today!
      > http://www.x-unity.net/teststudio.aspx\
      >
      > "Fox" <fox> wrote in message
      > news:%23Vz58zXG FHA.3608@TK2MSF TNGP14.phx.gbl. ..[color=green]
      >> How can I avoid datagrid to add a new record.
      >> Only allow datagrid to edit old record.
      >>
      >> Thank,
      >>
      >>[/color]
      >[/color]


      Comment

      • Naveed Anwar

        #4
        RE: question about datagrid(WinFor m)



        "Fox" wrote:
        [color=blue]
        > How can I avoid datagrid to add a new record.
        > Only allow datagrid to edit old record.
        >
        > Thank,
        >
        >
        >[/color]

        Comment

        Working...