Re: Datagrid allow edit in column when it's new row
- From: "Peter Proost" <pproost@xxxxxxxxxxxxxxxxxx>
- Date: Tue, 26 Apr 2005 14:41:36 +0200
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.
>
>
>
.
- References:
- Datagrid allow edit in column when it's new row
- From: Peter Proost
- Re: Datagrid allow edit in column when it's new row
- From: Ken Tucker [MVP]
- Datagrid allow edit in column when it's new row
- Prev by Date: Re: does anyone out there know how to create a messagebox with a time out
- Next by Date: Re: Another SQL vs. Access
- Previous by thread: Re: Datagrid allow edit in column when it's new row
- Next by thread: License Question
- Index(es):
Relevant Pages
|