Click here to Skip to main content
15,896,453 members
Please Sign up or sign in to vote.
3.00/5 (1 vote)
See more:
I need to be able to select multiple controls while the control key is pressed and the control is clicked with the mouse much in the way most windows programs work but i'm unclear on how to make this work

in my program i have 7 textboxes and a datagrid. I need to be able to allow the user to select individual controls using the mouse and also have a select button in a menu to do the same thing

Thanks
Posted
Updated 12-Sep-11 15:48pm
v2
Comments
Sergey Alexandrovich Kryukov 13-Sep-11 1:10am    
And what will you do with selected multiple controls. It's clear what to do with them under Designer: you can, say adjust some common property like background color or something. But in data grid?.. I see no sense.
If I'm not right, please explain.
--SA

1 solution

Selection of multiple control does not exist for controls as run-time objects. It is not needed during run time. Controls are not selected at all, but they are focused. However, selection of the controls is used in the Designer, but under Designer controls do not behave like "real" controls, a special design-time behavior is implemented; the controls play the role of graphical objects to be modified using graphical-style programming. But under Designer, selection of multiple controls is already implemented.

(See also my comment to the question.)

—SA
 
Share this answer
 
v2
Comments
Member 8231963 13-Sep-11 2:31am    
SO i would like to be able to make the click event of the control SELECT the text in the textbox and when the control key is pressed and held down it allows the FOCUS to be changed and the user to select the text within another textbox datagrid or whatever they need to highlight to copy paste etc just like in any normal program. To be selected for copying pasting or what have you.

IN other words simply put When a user clicks on each textbox or highlights a row in my datagrid or label or any control or container or whatever word you'd like to use THEY CAN HOLD DOWN THE CONTROL KEY ON THE KEYBOARD HIGHLIGHT THE TEXT OF THE CONTROL AND BE ABLE TO COPY PASTE CUT DELETE OR WHAT HAVE YOU

Just as you can in say a list of elements you hold control to select specific things for these functions and shift to select an entire set of data.

What i do not know is how to make this work in my program

I assume it has something to do with keydown event and the Selected property of the control
Member 8231963 13-Sep-11 12:06pm    
Hope that is more clear thanks for your help. Basically i want to have it like most other windows programs that being said the user holds down the control key and can select each textbox text or a datagrid row or column in order to copy the data to clipboard or paste it or use it elsewhere thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900