Re: Datagrid allow edit in column when it's new row



Thanks Ken,

now I know that I'm not makeing it to difficult, because there might as well
have been an easier solution which I didn't know.

Greetz Peter

--
Programming today is a race between software engineers striving to build
bigger and better idiot-proof programs, and the Universe trying to produce
bigger and better idiots. So far, the Universe is winning.

"Ken Tucker [MVP]" <vb2ae@xxxxxxxxxxxxx> schreef in bericht
news:OaPMwvlSFHA.2784@xxxxxxxxxxxxxxxxxxxxxxx
> Hi,
>
> Yes that is probably the best method.
> http://64.78.52.104/FAQ/WinForms/FAQ_c44c.asp#q823q
>
>
> Ken
> ----------------------
> "Peter Proost" <pproost@xxxxxxxxxxxxxxxxxx> wrote in message
> news:eqfednjSFHA.3720@xxxxxxxxxxxxxxxxxxxxxxx
> Hi group I'm making my own datagrid control, so for I've got a lot of
things
> working, combobox columns, checkbox columns, blobfield columns. But now I
> would like to be able the disable certain columns for editing I know I can
> use readonly for the columnstyle but this will also disallow me to edit
the
> cell when I add a new row.
> So I was thinking of using the overrides sub Edit in my class which
inherits
> from DataGridTextBoxColumn
> and then check if the current rownumber is smaller then the total number
of
> rownumbers, if it is true, disable editing else enable it. Now I was just
> wondering if this is the best way to do it.
>
> Private intAantalRijen as Integer
>
> Protected Overloads Overrides Sub Edit(ByVal source As
> System.Windows.Forms.CurrencyManager, ByVal _ rowNum As Integer, ByVal
> bounds As System.Drawing.Rectangle, ByVal [readOnly] As Boolean, ByVal _
> instantText As String, ByVal cellIsVisible As Boolean)
> If TypeOf (Me.DataGridTableStyle.DataGrid.DataSource) Is DataTable
> Then
> intAantalRijen =
> DirectCast(Me.DataGridTableStyle.DataGrid.DataSource,
DataTable).Rows.Count
> End If
> If rowNum = intAantalRijen Then
> MyBase.Edit(source, rowNum, bounds, [readOnly], instantText,
> cellIsVisible)
> End If
> End Sub
>
> Greetz Peter
>
> --
> Programming today is a race between software engineers striving to build
> bigger and better idiot-proof programs, and the Universe trying to produce
> bigger and better idiots. So far, the Universe is winning.
>
>
>


.



Relevant Pages

  • Re: 2 different numbers.....
    ... because if i do seven columns, the textbox wouldn't dispalyed numbers and cliicking several button again...limited to 2. ... Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: 2 different numbers.....
    ... Peter Proost wrote: ... Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: A couple of easy datagrid questions
    ... Greetz Peter ... bigger and better idiot-proof programs, and the Universe trying to produce ... bigger and better idiots. ... So far, the Universe is winning. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: number of lines in Richtextbox
    ... > hth Greetz Peter ... > bigger and better idiot-proof programs, and the Universe trying to produce ... > bigger and better idiots. ... So far, the Universe is winning. ...
    (microsoft.public.dotnet.languages.vb)
  • Re: Make font Bold
    ... Greetz Peter ... bigger and better idiot-proof programs, and the Universe trying to produce ... bigger and better idiots. ... So far, the Universe is winning. ...
    (microsoft.public.dotnet.languages.vb)