Hi Beth
It turns out I was my test case for this hadn't created a handle for the
control (ie, dgv.CreateControl, which a 'real' form does automatically for
you). That fixed this particular problem.
I probably wouldn't be much help with your VB syntax either :-). Thanks for
your reply.
Berryl
"Beth" <(E-Mail Removed)> wrote in message
news:25CA90AD-1925-4404-855E-(E-Mail Removed)...
> Hi, Berryl.
>
> Try commenting out your focus call.
> My VB code works without it:
> dgvReadOnly.CurrentCell = dgvReadOnly(gridColsToHide, row)
>
> otherwise, it could be a syntax thing. Can't help you with the C# syntax,
> sorry.
>
> HTH
>
> -Beth
>
> "Berryl Hesh" wrote:
>
>> When the dgv control is first initialized I want the focust to be in the
>> 3rd
>> column of the first row with data. Code below caused the program to
>> terminate.
>>
>> Thanks for sharing - BH
>>
>> public void SetFocusToDataEntry() {
>> _dgv.Focus();
>> _dgv.CurrentCell = _dgv.Rows[1].Cells[2];
>> }
>>
>>
>>
|