Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / January 2007

Tip: Looking for answers? Try searching our database.

datagrid set currentcell

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jochen Stümpfig - 28 Jan 2007 18:39 GMT
hello,

i have the problem that my clients want to copy content from an existing
cell to an new cell
using the shortcut ctrl-enter. i know how to move the cursor with ctrl-enter
to the next cell,
but the problem is that after execution of my code the datagrid focus lost
and the focus is on
the next control of my form. are there any hints of doing this in a correct
way?

my code:

const int WM_KEYDOWN = 0x100;
const int WM_SYSKEYDOWN = 0x104;
if((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYSKEYDOWN))
{
switch(keyData)
{
 case Keys.Control | Keys.Enter:

DataRow copyTo = view.Table.Rows[this.CurrentRowIndex];

DataRow copyFrom = view.Table.Rows[this.CurrentRowIndex-1];

copyTo[this.CurrentCell.ColumnNumber] =
copyFrom[this.CurrentCell.ColumnNumber];

SendKeys.Send("{Tab}");

  return true;
}
}

thanks, best regards jochen
ClayB - 28 Jan 2007 19:41 GMT
Instead of using SendKeys, just try explicitly setting the currentcell
where you want it to be.

         this.CurrentCell = new
DataGridCell(this.CurrentCell.RowNumber,this.CurrentCell.ColumnNumber
+ 1);

===============
Clay Burch
Syncfusion, Inc.
Jochen Stümpfig - 29 Jan 2007 19:21 GMT
thanks, this works...

regards jochen

> Instead of using SendKeys, just try explicitly setting the currentcell
> where you want it to be.
[quoted text clipped - 6 lines]
> Clay Burch
> Syncfusion, Inc.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.