I want to lock all controls except the buttons on a form. I sometimes need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks 7 1374
I'm sorry, I need the first line to read:
"I sometimes want to call lockControls(Me)"
Thanks
"RichG" wrote:
I want to lock all controls except the buttons on a form. I sometimes need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks
Rich,
Not really those who are accessible you can enable and dispable and some you
can prevent to edit.
The normal way to see if something is a button is by the way.
If typeof ctr Is Button then
I hope this gives some help,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:4C**********************************@microsof t.com...
>I want to lock all controls except the buttons on a form. I sometimes need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks
Hi, thanks for the response
Not really those who are accessible you can enable and dispable and some you
can prevent to edit.
I can't find "noedit" and "enabled" doe not work.
If typeof ctr Is Button then
Yes, that's a better way.. Thanks. I did not think about using "typeof". I
just have a consistant way of naming controls.
It's strange that this capability which I used so much in a previous version
of VB is not available here. I only occasionally need to dynamically "lock"
a control, but it is handy.
In this case I'm trying to make a form for "View" only, so that some people
can look at the values but cannot change them.
Rich
"Cor Ligthert [MVP]" wrote:
Rich,
Not really those who are accessible you can enable and dispable and some you
can prevent to edit.
The normal way to see if something is a button is by the way.
If typeof ctr Is Button then
I hope this gives some help,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:4C**********************************@microsof t.com...
I want to lock all controls except the buttons on a form. I sometimes need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks
Rich,
NoEdit was a quick way of writting of me, readonly is by instance in the
textbox http://msdn.microsoft.com/library/de...donlytopic.asp
Enable and disable should work, if you put them in a groupbox you can do
this even in one time. A bad thing from the enable is false is that it shows
up so ugly. However if you create a usercontrol with by instance a method
lock, than you can probably achieve what you want by changing some colours. http://msdn.microsoft.com/library/de...abledtopic.asp
I assume of course that you are doing this in a windowsform
I hope this helps,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:97**********************************@microsof t.com...
Hi, thanks for the response
>Not really those who are accessible you can enable and dispable and some you can prevent to edit.
I can't find "noedit" and "enabled" doe not work.
>If typeof ctr Is Button then
Yes, that's a better way.. Thanks. I did not think about using "typeof".
I
just have a consistant way of naming controls.
It's strange that this capability which I used so much in a previous
version
of VB is not available here. I only occasionally need to dynamically
"lock"
a control, but it is handy.
In this case I'm trying to make a form for "View" only, so that some
people
can look at the values but cannot change them.
Rich
"Cor Ligthert [MVP]" wrote:
>Rich,
Not really those who are accessible you can enable and dispable and some you can prevent to edit.
The normal way to see if something is a button is by the way.
If typeof ctr Is Button then
I hope this gives some help,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht news:4C**********************************@microso ft.com...
>I want to lock all controls except the buttons on a form. I sometimes need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks
Cor
Using ReadOnly appears to be available only within the form and not a
reference to the form. And it's only available when the control is
referenced by name and not as part of the controls collection. So I cannot
cycle through the controls collection in a sub that was called and passed the
form as a reference and lock the ones I want locked.
It looks like I will have to create a duplicate form for every form that
needs to be displayed read only, and lock every control on it except the
Close button.
How did we end up with a language has greater funtionallity but is less
funtional in the things we need to do. I guess such is progress............
Thanks Cor
Rich
"Cor Ligthert [MVP]" wrote:
Rich,
NoEdit was a quick way of writting of me, readonly is by instance in the
textbox
http://msdn.microsoft.com/library/de...donlytopic.asp
Enable and disable should work, if you put them in a groupbox you can do
this even in one time. A bad thing from the enable is false is that it shows
up so ugly. However if you create a usercontrol with by instance a method
lock, than you can probably achieve what you want by changing some colours.
http://msdn.microsoft.com/library/de...abledtopic.asp
I assume of course that you are doing this in a windowsform
I hope this helps,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:97**********************************@microsof t.com...
Hi, thanks for the response
Not really those who are accessible you can enable and dispable and some
you
can prevent to edit.
I can't find "noedit" and "enabled" doe not work.
If typeof ctr Is Button then
Yes, that's a better way.. Thanks. I did not think about using "typeof".
I
just have a consistant way of naming controls.
It's strange that this capability which I used so much in a previous
version
of VB is not available here. I only occasionally need to dynamically
"lock"
a control, but it is handy.
In this case I'm trying to make a form for "View" only, so that some
people
can look at the values but cannot change them.
Rich
"Cor Ligthert [MVP]" wrote:
Rich,
Not really those who are accessible you can enable and dispable and some
you
can prevent to edit.
The normal way to see if something is a button is by the way.
If typeof ctr Is Button then
I hope this gives some help,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:4C**********************************@microsof t.com...
I want to lock all controls except the buttons on a form. I sometimes
need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks
Rich,
You can reach it,
if Typeof ctr Is Textbox then
DirectCast(ctr,Texbox).ReadOnly
End if
Just typed here,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:03**********************************@microsof t.com...
Cor
Using ReadOnly appears to be available only within the form and not a
reference to the form. And it's only available when the control is
referenced by name and not as part of the controls collection. So I
cannot
cycle through the controls collection in a sub that was called and passed
the
form as a reference and lock the ones I want locked.
It looks like I will have to create a duplicate form for every form that
needs to be displayed read only, and lock every control on it except the
Close button.
How did we end up with a language has greater funtionallity but is less
funtional in the things we need to do. I guess such is
progress............
Thanks Cor
Rich
"Cor Ligthert [MVP]" wrote:
>Rich,
NoEdit was a quick way of writting of me, readonly is by instance in the textbox
http://msdn.microsoft.com/library/de...donlytopic.asp
Enable and disable should work, if you put them in a groupbox you can do this even in one time. A bad thing from the enable is false is that it shows up so ugly. However if you create a usercontrol with by instance a method lock, than you can probably achieve what you want by changing some colours.
http://msdn.microsoft.com/library/de...abledtopic.asp
I assume of course that you are doing this in a windowsform
I hope this helps,
Cor "RichG" <Ri***@discussions.microsoft.comschreef in bericht news:97**********************************@microso ft.com...
Hi, thanks for the response Not really those who are accessible you can enable and dispable and some you can prevent to edit.
I can't find "noedit" and "enabled" doe not work.
If typeof ctr Is Button then
Yes, that's a better way.. Thanks. I did not think about using
"typeof".
I
just have a consistant way of naming controls.
It's strange that this capability which I used so much in a previous
version
of VB is not available here. I only occasionally need to dynamically
"lock"
a control, but it is handy.
In this case I'm trying to make a form for "View" only, so that some
people
can look at the values but cannot change them.
Rich
"Cor Ligthert [MVP]" wrote:
Rich,
Not really those who are accessible you can enable and dispable and some you can prevent to edit.
The normal way to see if something is a button is by the way.
If typeof ctr Is Button then
I hope this gives some help,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht news:4C**********************************@microso ft.com... I want to lock all controls except the buttons on a form. I sometimes need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks
Your the MAN Cor!!!!!
When I implemented the code you gave me (after adding .ReadOnly = True), I
found that only three controls were locked. When I ran it through the
debugger, I found that most of the other controls were in hidden by
GroupBoxes. The GroupBox does not have a ReadOnly so I just set
groupbox.enabled=false. That disabled everything in the group box. Then I
found that the DatTimePicker and ComboBox controls would not work in the
syntax you sent me but they would disable.
So I just disabled every thing except the buttons.
Thanks Cor!
"Cor Ligthert [MVP]" wrote:
Rich,
You can reach it,
if Typeof ctr Is Textbox then
DirectCast(ctr,Texbox).ReadOnly
End if
Just typed here,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:03**********************************@microsof t.com...
Cor
Using ReadOnly appears to be available only within the form and not a
reference to the form. And it's only available when the control is
referenced by name and not as part of the controls collection. So I
cannot
cycle through the controls collection in a sub that was called and passed
the
form as a reference and lock the ones I want locked.
It looks like I will have to create a duplicate form for every form that
needs to be displayed read only, and lock every control on it except the
Close button.
How did we end up with a language has greater funtionallity but is less
funtional in the things we need to do. I guess such is
progress............
Thanks Cor
Rich
"Cor Ligthert [MVP]" wrote:
Rich,
NoEdit was a quick way of writting of me, readonly is by instance in the
textbox
http://msdn.microsoft.com/library/de...donlytopic.asp
Enable and disable should work, if you put them in a groupbox you can do
this even in one time. A bad thing from the enable is false is that it
shows
up so ugly. However if you create a usercontrol with by instance a method
lock, than you can probably achieve what you want by changing some
colours.
http://msdn.microsoft.com/library/de...abledtopic.asp
I assume of course that you are doing this in a windowsform
I hope this helps,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:97**********************************@microsof t.com...
Hi, thanks for the response
Not really those who are accessible you can enable and dispable and
some
you
can prevent to edit.
I can't find "noedit" and "enabled" doe not work.
If typeof ctr Is Button then
Yes, that's a better way.. Thanks. I did not think about using
"typeof".
I
just have a consistant way of naming controls.
It's strange that this capability which I used so much in a previous
version
of VB is not available here. I only occasionally need to dynamically
"lock"
a control, but it is handy.
In this case I'm trying to make a form for "View" only, so that some
people
can look at the values but cannot change them.
Rich
"Cor Ligthert [MVP]" wrote:
Rich,
Not really those who are accessible you can enable and dispable and
some
you
can prevent to edit.
The normal way to see if something is a button is by the way.
If typeof ctr Is Button then
I hope this gives some help,
Cor
"RichG" <Ri***@discussions.microsoft.comschreef in bericht
news:4C**********************************@microsof t.com...
I want to lock all controls except the buttons on a form. I
sometimes
need
the form to call lockForms(Me).
public sub lockControls(frm as form)
for each ctrl as control in frm
if left(ctrl.name,3)<>"btn" then
ctrl.locked=true
endif
next
end sub
Unfortunitly "ctrl.locked=true" is not valid in .net 2.0.
Is there an equivalent method in 2.0 for this?
Thanks
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: MS |
last post by:
Access 97 here.
I want a simple way to "lock" certain records on a form. Some records remain
"live" until all data is available which happens over time. When all the
fields are complete, I want...
|
by: TechBoy |
last post by:
I have 2 forms FrmMain and frmSearch.
On frmMain I have to lock the textboxes and combo boxes on the form if
the user logged out that record.
FrmMain has a command button that launches...
|
by: jonelling |
last post by:
I am having a problem where the page load event is not being fired
for certain user controls that I load dynamically in placeholders.
Here is what I'm doing in brief, with full test code supplied...
|
by: Laura T. |
last post by:
To synchronize thread access to shared objects, I've always used the
lock(shared_object) { } pattern.
I've seen many recommendations and examples where to synchronize use
lock(another_object) {...
|
by: Schroeder |
last post by:
I have a DataSet that is cached deep down in a business layer object.
Higher up, there's a merge being performed on that object and it very
occassionaly throws a NullReferenceException deep down in...
|
by: crgsmrt |
last post by:
Hi all,
I'd really appreciate it if someone was able to help me out with a
problem I'm having with C#. I'm a complete newbie to this, so please
excuse what may appear as a stupid question. ...
|
by: Ami |
last post by:
Hello everyone,
I have developed a small access application and now I need to lock my
forms against unwanted edits.
I have used the code by Allen Browne I found here...
|
by: Michael728 |
last post by:
Need some help please.
There are 4 tables in this database. Six controls on the form are related to the table Degree. The other controls on the form are related to the other three tables.
My...
|
by: tim2006 |
last post by:
When i try to run the program, it just hangs. If i remove the axwebbrowser control it works fine.
Any ideas?
Here is my code:
class1.vb
Imports System.Windows.Forms
Imports...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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: 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...
|
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,...
|
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...
|
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,...
|
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...
|
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...
| |