Hi
In my Windows Form application I created a File Browser control that was
derived from System.Windows.Forms.UserControl. It contains a single line text
box and a button. The user can enter a filename in the text box or hit the
browse button, popup the File Open Dialog box, and select a file. The
subsequent selection is placed in the text box. We've seen this type of
control everywhere so I'm not sure why it's not a standard control in the
Framework. But, I digress.
This control is placed in a DataGrid using a column derived from
DataGridColumnStyle. Everything works great except when I’m entering text in
the text box of my File Browser control, hitting Left, Right, Home, or End
moves the current cell in the DataGrid instead of moving the caret in the
text box.
I’m not sure if it’s the DataGrid that’s stealing the key or the UserControl
that’s giving the key to the DataGrid. In other words, I’ve been trying to
hunt this thing down and I can’t find it let alone fix it.
Any help would be appreciated.
Thanks 2 1777
Well, I’ve found that if I derive a class from TextBox and use that in my
UserControl instead of using the stock TextBox, override the ProcessCmdKey()
method, and move the caret myself, I can get this to work correctly.
This seems really sloppy though. I don’t know why the TextBox is not using
the keys and letting the messages bubble up to the grid control.
Anyone have any ideas?
Thanks.
"dlgproc" wrote: Hi
In my Windows Form application I created a File Browser control that was derived from System.Windows.Forms.UserControl. It contains a single line text box and a button. The user can enter a filename in the text box or hit the browse button, popup the File Open Dialog box, and select a file. The subsequent selection is placed in the text box. We've seen this type of control everywhere so I'm not sure why it's not a standard control in the Framework. But, I digress.
This control is placed in a DataGrid using a column derived from DataGridColumnStyle. Everything works great except when I’m entering text in the text box of my File Browser control, hitting Left, Right, Home, or End moves the current cell in the DataGrid instead of moving the caret in the text box.
I’m not sure if it’s the DataGrid that’s stealing the key or the UserControl that’s giving the key to the DataGrid. In other words, I’ve been trying to hunt this thing down and I can’t find it let alone fix it.
Any help would be appreciated. Thanks
"=?Utf-8?B?ZGxncHJvYw==?=" <dl*****@discussions.microsoft.com> wrote in message news:<91**********************************@microso ft.com>... Well, I’ve found that if I derive a class from TextBox and use that in my UserControl instead of using the stock TextBox, override the ProcessCmdKey() method, and move the caret myself, I can get this to work correctly.
This seems really sloppy though. I don’t know why the TextBox is not using the keys and letting the messages bubble up to the grid control.
Anyone have any ideas? Thanks.
"dlgproc" wrote:
Hi
In my Windows Form application I created a File Browser control that was derived from System.Windows.Forms.UserControl. It contains a single line text box and a button. The user can enter a filename in the text box or hit the browse button, popup the File Open Dialog box, and select a file. The subsequent selection is placed in the text box. We've seen this type of control everywhere so I'm not sure why it's not a standard control in the Framework. But, I digress.
This control is placed in a DataGrid using a column derived from DataGridColumnStyle. Everything works great except when I’m entering text in the text box of my File Browser control, hitting Left, Right, Home, or End moves the current cell in the DataGrid instead of moving the caret in the text box.
I’m not sure if it’s the DataGrid that’s stealing the key or the UserControl that’s giving the key to the DataGrid. In other words, I’ve been trying to hunt this thing down and I can’t find it let alone fix it.
Any help would be appreciated. Thanks
Hi dlgproc,
I'm expiriencing right now the same problem. So I overwrote the
ProcessCmdKey as you did and that's ok; but what about if you want to
select just a part of text in your derived TextBox by pressing <Shift>
+ <LeftArrow>?
I can't believe I have to overwrite every TextBox behavior!!
Any help appreciated
Thanks a lot This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Alessandro Rossi |
last post by:
Hi
I developed a usercontrol with a textbox and an htmlInputHidden
When I add my usercontrol in a webform, it works properly
If I add my control in a template column of a datagrid i have some...
|
by: Colin Ramsay |
last post by:
Hi all,
I don't normally post swathes of code like this but I am truly banging
my head off my desk here...
I've dynamically created a datagrid within a usercontrol. There are two
columns...
|
by: Tim_Mac |
last post by:
hi,
i have an aspx page which dynamically loads a user control and adds it
to a placeholder. the control is recreated and added to the
placeholder for postbacks as well.
the user control...
|
by: ºa¤Ö |
last post by:
Dear All Experts
I faced a problem, I had developed a UserControl (just a simple display the
website logo), and added into a ASPX page.
Inside the ASPX, i have a DataGrid control, and it...
|
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...
|
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...
|
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,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |