473,473 Members | 1,576 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

enumerate selected controls in design view of a form

I am working on a project that requires me to be able to enumerate
through all the controls that may be selected (ie: showing their
selection handles) in a forms design view window. I have managed to
capture the active form and can iterate through all the controls on the
form but I want to be able to minimise the list to only the controls
with the selection handles are identified.

Any help would be greatly appreciated.
Greg J

Apr 28 '06 #1
1 2713
ADezii
8,834 Recognized Expert Expert
I am working on a project that requires me to be able to enumerate
through all the controls that may be selected (ie: showing their
selection handles) in a forms design view window. I have managed to
capture the active form and can iterate through all the controls on the
form but I want to be able to minimise the list to only the controls
with the selection handles are identified.

Any help would be greatly appreciated.


Greg J
The InSelection Property should be exactly what you are looking for:

'To determine the Selection status of a Control on a Form in Design View,
'execute the following code from the Debug Window (It can easily be
'modified to adapt to your specific needs)

? IsControlSelected (Forms!Customers, "CompanyName")

Function IsControlSelected(frm As Form, strControlName As String) As Integer
Dim intI As Integer, ctl As Control
If frm.CurrentView <> 0 Then
' Form is not in Design view.
Exit Function
Else
For intI = 0 To frm.Count - 1
Set ctl = frm(intI)
If ctl.InSelection = True Then
' Is desired control selected?
If UCase(ctl.Name) = UCase(strControlName) Then
IsControlSelected = True
Exit Function
End If
Else
IsControlSelected = False
End If
Next intI
End If
End Function

'Hope this works for you
Apr 28 '06 #2

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

Similar topics

2
by: Dave | last post by:
Hi I'm creating a fairly simple Staff database using Access 97. There is a table, which stores all of the staff details (initials, firstname, surname, tel. no. etc.) and I want to design a...
10
by: BBM | last post by:
Hi, I have been developing with C# User Controls and occasionally have a problem where I "lose" a control from the design surface of the User Control. The controls that I am using to build my...
0
by: Frnak McKenney | last post by:
I'm running into problems with VisualStudio.NET2003 and Windows Forms inheritance. It _feels_ like a bug, but it could just as well be a misunderstanding on my part regarding how the VS Designer...
4
by: Boban Dragojlovic | last post by:
I create a new webform (I always use codebehind), and I insert some server-side controls into the form (the ASPX) Later, I switch to codeview, and I notice that some (sometimes all) of the...
6
by: Nathan Sokalski | last post by:
I am trying to dynamically add controls to my page, but am having trouble with controls such as buttons. I have been able to add simple controls such as Label controls, because they can be placed...
14
by: Jan Nielsen | last post by:
Hi In Microsoft Access it is possible to write code like this Sub test() DoCmd.OpenForm "TestForm", acDesign Dim a As Control For Each a In Forms("TestForm").Controls Do stuff Next End Sub
6
by: nbeaubien | last post by:
I would like to know the way to determine witch controls are selected in a multi-selection on a form in design mode with VBA.
4
by: rn5a | last post by:
I am binding a DropDownList with records existing in a database table. I want to add an extra item *SELECT COMPANY* at index 0 so that by default, it gets selected. This is how I tried it but the...
1
by: =?Utf-8?B?UmljaA==?= | last post by:
I removed a form and all its associated files (designer, vb, resx) from a project because I was having a problem with that form. I copied these files to another folder away from the project...
0
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...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.