473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Send keystroke to a datagridview control

Hi everybody...
i need help with this issue: i have a textbox control with the focus. at
side, i have a datagridview control populated with some data. i need to
control behavior of dgv control from textbox. when i press pagedown/pageup
key (in textbox), i need to send that key to dgw, to move the data up/down,
but, without loss the focus in textbox. i already studied the sendkeys.send,
but i dont know how to send a key to control, the examples just explain how
to control a external app like calculator..

Thanks in advance.
Apr 28 '07 #1
3 2870
You might be better served to use the binding navigator for that purpose
(essentially what it is designed for). In any event, the easiest method to
do what you want with a textbox is probably to use the KeyUp or Keypress
events, parse out the pagedown/pageup keystrokes, then move thru up or down
through a bindingsource attached to the dgv.

"Bernardo Salazar newb" <Bernardo Salazar ne**@discussions.microsoft.com>
wrote in message news:E8**********************************@microsof t.com...
Hi everybody...
i need help with this issue: i have a textbox control with the focus. at
side, i have a datagridview control populated with some data. i need to
control behavior of dgv control from textbox. when i press pagedown/pageup
key (in textbox), i need to send that key to dgw, to move the data
up/down,
but, without loss the focus in textbox. i already studied the
sendkeys.send,
but i dont know how to send a key to control, the examples just explain
how
to control a external app like calculator..

Thanks in advance.

Apr 29 '07 #2
Hi Earl, thanks for your time.
I can comment, the dgv are binding a datatable, and, when i add data to dgv,
i do this task adding the data to datatable directly. The desired effect is:
i catch pgdn/pgup trough keypress event in a textbox, and move the displayed
data in dvg up/down accordingly. My app have a "data post window", and all
typed data goes to the dgv. but sometimes, you may check what items typed,
and using pgdn/pgup, the user can visualize what are up or down in the
"ticket". i dont know if is possible to send "keystrokes" to a control (in
this case the dgv), or i have to do a different approach (using something
like dgv.firstdisplayedscrollingrowindex). Thanks again for your advice.
--
Bernardo Salazar
"Earl" wrote:
You might be better served to use the binding navigator for that purpose
(essentially what it is designed for). In any event, the easiest method to
do what you want with a textbox is probably to use the KeyUp or Keypress
events, parse out the pagedown/pageup keystrokes, then move thru up or down
through a bindingsource attached to the dgv.

"Bernardo Salazar newb" <Bernardo Salazar ne**@discussions.microsoft.com>
wrote in message news:E8**********************************@microsof t.com...
Hi everybody...
i need help with this issue: i have a textbox control with the focus. at
side, i have a datagridview control populated with some data. i need to
control behavior of dgv control from textbox. when i press pagedown/pageup
key (in textbox), i need to send that key to dgw, to move the data
up/down,
but, without loss the focus in textbox. i already studied the
sendkeys.send,
but i dont know how to send a key to control, the examples just explain
how
to control a external app like calculator..

Thanks in advance.


Apr 29 '07 #3
It would be easier to accomplish what you are trying to do if you bind the
datatable to a bindingsource, then use the bindingsource as datasource for
the dgv.

"Bernardo Salazar newb" <Be*****************@discussions.microsoft.com>
wrote in message news:42**********************************@microsof t.com...
Hi Earl, thanks for your time.
I can comment, the dgv are binding a datatable, and, when i add data to
dgv,
i do this task adding the data to datatable directly. The desired effect
is:
i catch pgdn/pgup trough keypress event in a textbox, and move the
displayed
data in dvg up/down accordingly. My app have a "data post window", and all
typed data goes to the dgv. but sometimes, you may check what items typed,
and using pgdn/pgup, the user can visualize what are up or down in the
"ticket". i dont know if is possible to send "keystrokes" to a control (in
this case the dgv), or i have to do a different approach (using something
like dgv.firstdisplayedscrollingrowindex). Thanks again for your advice.
--
Bernardo Salazar
"Earl" wrote:
>You might be better served to use the binding navigator for that purpose
(essentially what it is designed for). In any event, the easiest method
to
do what you want with a textbox is probably to use the KeyUp or Keypress
events, parse out the pagedown/pageup keystrokes, then move thru up or
down
through a bindingsource attached to the dgv.

"Bernardo Salazar newb" <Bernardo Salazar ne**@discussions.microsoft.com>
wrote in message
news:E8**********************************@microso ft.com...
Hi everybody...
i need help with this issue: i have a textbox control with the focus.
at
side, i have a datagridview control populated with some data. i need to
control behavior of dgv control from textbox. when i press
pagedown/pageup
key (in textbox), i need to send that key to dgw, to move the data
up/down,
but, without loss the focus in textbox. i already studied the
sendkeys.send,
but i dont know how to send a key to control, the examples just explain
how
to control a external app like calculator..

Thanks in advance.



Apr 29 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: DraguVaso | last post by:
Hi, I'm using the DataGridView in VB.NET 2.0. The DataSource is a Generic List of a custom class0: lstMyPersonnes = New List(Of clsPersonne). When I add a new clsPersonne to lstMyPersonnes,...
1
by: Rich | last post by:
Hello, I am reading data from a sql server table that is under replication. This table has the replicatin GUID column that is generated with replicatin. I am reading the data from a...
7
by: Mitchell S. Honnert | last post by:
Is there an equivalent of the DataGrid's DataGridTableStyle for the DataGridView? If not, is there an easy way to duplicate the DataGridTableStyle's functionality for the DataGridView? Here's...
1
by: Karl | last post by:
Hi all... This is a good one. You'll like this... I am working on a course management tool that allows certain Courses to be cross referenced with Job Roles and, when they are, whether the...
0
by: jeastman - Hotmail | last post by:
Hello world Excuse, not to be written English and it helps me with a translator. I am new programming in C#. I made a control inheriting the DataGridView to be able to add controls done by...
1
by: Jeff | last post by:
Hey ..NET 2.0 I've created a User Control which contain a DataGridView. This User Control is displayed on a TabPage. This TabPage is added to the TabControl during runtime. The problem is...
2
by: TamusJRoyce | last post by:
I was curious if there is an easy way, besides making a new custom DataGridViewColumn, that on each keystroke validation is done (while the D.G.V.TextBoxCell is being edited), instead of when focus...
0
by: priyamtheone | last post by:
I'm trying to make a datagridview column to act like a datetimepicker column (C#.Net 2005). These are the behaviours that the dgv should have: 1) Initially all the cells of the dtp column should be...
4
by: alex21 | last post by:
Ok im getting this exception from a DataGridView control in my program. System.ArgumentOutOfRangeException was unhandled Message="Value of '132' is not valid for 'Value'. 'Value' should be...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.