TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
cory thompson
NA
29
27.4k
Get focused
Jan 9 2012 5:23 PM
Hi guys, I'm trying to get the focused textbox so I can insert a time stamp, the code below will put a timestamp into textBox1 but I dont want to define the textbox so i'm looking for something like "focused.text" instead of "textBox1.text".
Can anyone help with this
Thanks.
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
{
switch (keyData)
{
case Keys.Control | Keys.T:
var insertText = DateTime.Now.ToString();
var selectionIndex = textBox1.SelectionStart;
textBox1.Text = textBox1.Text.Insert(selectionIndex, insertText);
textBox1.SelectionStart = selectionIndex + insertText.Length;
return true;
}
return false;
}
Reply
Answers (
2
)
Who could help me?
Search in a list for more than one search term