You could use try this. I did not test it. If you try it, please post
whether it works.
Dim tc() As DataGridTextBoxColumn = {New DataGridTextBoxColumn(), _
New DataGridTextBoxColumn()}
'Set properties of tablecolumns
tc(0).MappingName = "Col1"
tc(0).HeaderText = "Col 1"
tc(0).ReadOnly = True
tc(1).MappingName = "Col2"
'...
Dim ts As New DataGridTableStyle()
ts.GridColumnStyles.AddRange(tc)
Me.DataGrid1.TableStyles.Add(ts)
me.DataGrid1.DataSource = 'datatable or dataview. Fields are mapped
by mapping names. Each mapping name must match a field.
www.charlesfarriersoftware.com
"Agnes" wrote:
> In textbox, I know I can set e.handled = false in keypressevent , So I can
> restrict the user to input some invalid character or disallow the user to
> input any thing
> Now, in datagrid, there are 3 columns one is account code, 2nd is debit, 3rd
> is credit
> for some account code, (e.g bank) I want to allow the user to input both
> debit and credit column/
> BUT for some account code( E.g salary) I want to disallow the user type
> anything in 'credit' column.
>
> I try edit some code in ProcessCmdKey() , and d/l the some sample code
> from http://www.syncfusion.com/FAQ/WinForms/FAQ_c44c.asp
> But I still fail to restrict the user ,
> Does anyone got some idea ?
>
> --
> ..
>
>
>