473,779 Members | 2,083 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Read Only Controls

I have a form, and I only want the user to be able to change the controls if
they click an Edit button.
I want the user to able copy the data from my controls, even without
clicking edit, so I want to leave the controls enabled.
I planned on putting "R" in the tags of the controls I want to be real
only, and coding like this:

Dim x As Control

For Each x In Me.Controls
If x.Tag = "R" Then
x.ReadOnly = True
End If
Next
So, when the form loads, I set my textboxes Readonly property to True.
However, there is no read only property on combo boxes and DateTimePickers .
What should on do in those cases?

Thanks
Vayse
Nov 23 '05 #1
5 1791
Hey Vayse,

Have a look at:
http://groups.google.com/group/micro...a7b76a2b2462c2

Hope it will help you,

Michel van den Berg
"Vayse" <Va***@nospam.n ospam> schreef in bericht
news:uy******** ******@TK2MSFTN GP12.phx.gbl...
I have a form, and I only want the user to be able to change the controls
if they click an Edit button.
I want the user to able copy the data from my controls, even without
clicking edit, so I want to leave the controls enabled.
I planned on putting "R" in the tags of the controls I want to be real
only, and coding like this:

Dim x As Control

For Each x In Me.Controls
If x.Tag = "R" Then
x.ReadOnly = True
End If
Next
So, when the form loads, I set my textboxes Readonly property to True.
However, there is no read only property on combo boxes and
DateTimePickers . What should on do in those cases?

Thanks
Vayse

Nov 23 '05 #2
You can maybe use the .Enabled-property?

"Vayse" <Va***@nospam.n ospam> wrote in message
news:uy******** ******@TK2MSFTN GP12.phx.gbl...
I have a form, and I only want the user to be able to change the controls
if they click an Edit button.
I want the user to able copy the data from my controls, even without
clicking edit, so I want to leave the controls enabled.
I planned on putting "R" in the tags of the controls I want to be real
only, and coding like this:

Dim x As Control

For Each x In Me.Controls
If x.Tag = "R" Then
x.ReadOnly = True
End If
Next
So, when the form loads, I set my textboxes Readonly property to True.
However, there is no read only property on combo boxes and
DateTimePickers . What should on do in those cases?

Thanks
Vayse

Nov 23 '05 #3
Hi Vayse,

Thanks for your post.

Can you show me the exactly meaning of ReadOnly for
combobox/DateTimePicker, what behavior do you want? Thanks.

"Michel van den Berg" has provided you a useful link, in the link,
"Herfried K. Wagner [MVP]" finds the TextBox part of the combobox and set
it to readonly, does this meet your need? However we still have the problem
of whether or not to enable the dropdown function of
combobox/DateTimePicker, this is based on the function you want.

For TextBox, you want it to be selectable, so you do not want to use Enable
property, however for combobox/DateTimePicker, there should not be such
concern, can we disable these 2 controls to achieve what you want?

Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 23 '05 #4
Have a look at my July 2005 article from http://emoreau.s2i.com/

--
HTH

Éric Moreau, MCSD, Visual Developer - Visual Basic MVP
(http://aspnet2.com/mvp.ashx?EricMoreau)
Conseiller Principal / Senior Consultant
Concept S2i inc. (www.s2i.com)
http://pages.videotron.com/emoreau/

"Vayse" <Va***@nospam.n ospam> wrote in message
news:uy******** ******@TK2MSFTN GP12.phx.gbl...
I have a form, and I only want the user to be able to change the controls
if they click an Edit button.
I want the user to able copy the data from my controls, even without
clicking edit, so I want to leave the controls enabled.
I planned on putting "R" in the tags of the controls I want to be real
only, and coding like this:

Dim x As Control

For Each x In Me.Controls
If x.Tag = "R" Then
x.ReadOnly = True
End If
Next
So, when the form loads, I set my textboxes Readonly property to True.
However, there is no read only property on combo boxes and
DateTimePickers . What should on do in those cases?

Thanks
Vayse

Nov 23 '05 #5
Hi Vayse,

Does our replies make sense to you? Is your problem resolved? Please feel
free to feedback. Thanks

Best regards,
Jeffrey Tan
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "as is" with no warranties and confers no rights.

Nov 23 '05 #6

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

Similar topics

2
1784
by: Julie | last post by:
I'm wondering what standard/best practices are for the following scenario: I have a page representing several fields for stored data. If the user has sufficient access privileges, the page is rendered w/ read/write text boxes and they can edit the various fields as needed. However, if the user doesn't have sufficient privileges (i.e. view only), the page is rendered w/ the text boxes set to read-only. However, this results in a rather...
7
3019
by: Shimon Sim | last post by:
I have a custom composite control I have following property
3
3400
by: Paul Close | last post by:
How does one make all controls on a Windows form read-only? Controls such as check boxes, combo boxes and date time pickers dont appear to have a read-only property. Disabling the controls makes them hard to read and you cant select/copy the contents of text boxes. Thanks
14
2955
by: MLH | last post by:
I use A97. I've gotten used to reading values from textbox controls on forms, I've come to rely on it pretty heavily. My habit spills over into reports. I'm uncertain whether I can reliably read the values in textbox controls on reports during the OnFormat event code the same way I've been doing so in forms. I have a report I call the 402 report and on it is a LaborCost textbox. I use a line of code something like this If txtLaborCost...
2
1825
by: Vish | last post by:
Hi, I amplanning on having a rea-only and edit states for my form. But it do not want my form and its controls to look different or disabled. I am planning on having a edit button that brings the form from read-only to a edit state. Is there any easy or built-in way of doing this in .NET? My preimary purpose for doing it because the combobox controls on my form take a while to load all their data from the database. Since the user uses...
4
2675
by: CrimeMaster | last post by:
HI I have an Exe file when it runs ,there are just two controls on the window.One is a ListBox and another is a Multi line Rich Edit control.When i click on an item in the list some text is displayed in the Edit control.Exe have a Hunderds of items in the List controls,which display some text in edit control against an item selection. I want to read that data which is displayed in edit control against the selection of an item in list...
1
1533
by: ncjed | last post by:
First off, my apologies if this topic has previously been covered. I am in the process of creating an A2K DB (Win XP) that will open other DBs (either on local drive, mapped drives, or UNC network path). My current goal is to open all forms from the target DB, read through the controls, and if the length of the control's property is > 0 (eliminate nulls and blanks), write the value out to a table on my local DB. I am using the...
23
2228
by: Dan Tallent | last post by:
A textbox has a attribute for ReadOnly. This seems like such a simple concept. When a textbox is set to read only the user cannot change the contents of the field. I have been trying to find that missing ability for other predefined controls in C#. The radiobutton, checkbox, and combobox controls do not share this ability. I find it difficult to believe that this feature was left out and Microsoft expects everyone to write...
0
9636
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9474
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10306
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10075
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7485
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6727
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5373
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5504
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.