Home All Groups Group Topic Archive Search About
Author
8 Mar 2006 10:11 AM
Alastair MacFarlane
Dear All,

I have a datagrid with a DateTime Picker control and a combo control on it.
The problem I am having is moving around the grid after pressing Return or
Tab.

Controls: DbGrid1, DTPicker1, Combo1

Column1 = DTPicker1;
Column2 = Normal Column;
Column3 = Combo1;
Column4 = Normal Column

What I am trying to achieve is for the user to select a value or type a
value in the DTPicker1 control and press Tab or Return and the focus will go
to column2 and then the same with Combo1 and press Tab or Return to go to
Column4.

I would presume that I would use the following code for the DateTime Picker:

Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode  = vbKeyTab or KeyCode  = vbKeyReturn then
        Me.grdDataGrid.Col = Me.grdDataGrid.Col + 1
End if
End Sub

.... but the keydown is not fired as I would expect.

Any advice would be appreciated.

Thanks again.

Alastair MacFarlane

Author
8 Mar 2006 4:23 PM
Norm Cook
Assuming the DTPicker is 'floated' over the grid try this

Private Sub DTPicker1_LostFocus()
>         Me.grdDataGrid.Col = Me.grdDataGrid.Col + 1

Me.grdDataGrid.SetFocus
End Sub


Show quoteHide quote
"Alastair MacFarlane" <AlastairMacFarl***@discussions.microsoft.com> wrote
in message news:7D9368C7-2243-4B72-99A9-19DC1C043F16@microsoft.com...
> Dear All,
>
> I have a datagrid with a DateTime Picker control and a combo control on
it.
> The problem I am having is moving around the grid after pressing Return or
> Tab.
>
> Controls: DbGrid1, DTPicker1, Combo1
>
> Column1 = DTPicker1;
> Column2 = Normal Column;
> Column3 = Combo1;
> Column4 = Normal Column
>
> What I am trying to achieve is for the user to select a value or type a
> value in the DTPicker1 control and press Tab or Return and the focus will
go
> to column2 and then the same with Combo1 and press Tab or Return to go to
> Column4.
>
> I would presume that I would use the following code for the DateTime
Picker:
>
> Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
> If KeyCode  = vbKeyTab or KeyCode  = vbKeyReturn then
>         Me.grdDataGrid.Col = Me.grdDataGrid.Col + 1
> End if
> End Sub
>
> ... but the keydown is not fired as I would expect.
>
> Any advice would be appreciated.
>
> Thanks again.
>
> Alastair MacFarlane
>
Author
8 Mar 2006 6:56 PM
Alastair MacFarlane
Norm,

Thanks for the suggestion. I had tried the LostFocus event but as you had
noticed, I hadn't set the focus back on the control so the control was
indeed at the correct column all along.

Thanks for pointing that one out to me.

Alastair MacFarlane

Show quoteHide quote
"Norm Cook" <normcookNOSPAM@cableone.net> wrote in message
news:120u18s4tj9kvc1@corp.supernews.com...
> Assuming the DTPicker is 'floated' over the grid try this
>
> Private Sub DTPicker1_LostFocus()
>>         Me.grdDataGrid.Col = Me.grdDataGrid.Col + 1
>
> Me.grdDataGrid.SetFocus
> End Sub
>
>
> "Alastair MacFarlane" <AlastairMacFarl***@discussions.microsoft.com> wrote
> in message news:7D9368C7-2243-4B72-99A9-19DC1C043F16@microsoft.com...
>> Dear All,
>>
>> I have a datagrid with a DateTime Picker control and a combo control on
> it.
>> The problem I am having is moving around the grid after pressing Return
>> or
>> Tab.
>>
>> Controls: DbGrid1, DTPicker1, Combo1
>>
>> Column1 = DTPicker1;
>> Column2 = Normal Column;
>> Column3 = Combo1;
>> Column4 = Normal Column
>>
>> What I am trying to achieve is for the user to select a value or type a
>> value in the DTPicker1 control and press Tab or Return and the focus will
> go
>> to column2 and then the same with Combo1 and press Tab or Return to go to
>> Column4.
>>
>> I would presume that I would use the following code for the DateTime
> Picker:
>>
>> Private Sub DTPicker1_KeyDown(KeyCode As Integer, Shift As Integer)
>> If KeyCode  = vbKeyTab or KeyCode  = vbKeyReturn then
>>         Me.grdDataGrid.Col = Me.grdDataGrid.Col + 1
>> End if
>> End Sub
>>
>> ... but the keydown is not fired as I would expect.
>>
>> Any advice would be appreciated.
>>
>> Thanks again.
>>
>> Alastair MacFarlane
>>
>
>