473,698 Members | 2,594 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

vs2005 - 'The event Click is read-only and cannot be changed' - What?

Hello,

What does this error mean?
"The event click is read-only and cannot be changed"

This is a design-time error. It is displayed instead of the form.

Here is the full text
\\
"One or more errors encountered while loading the designer. The errors
are listed below. Some errors can be fixed by rebuilding your project,
while others may require code changes.

The event click is read-only and cannot be changed

at
System.Componen tModel.Design.E ventBindingServ ice.EventProper tyDescriptor.Se tValue(Object
component, Object value)
at
System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eAttachEventSta tement(IDesigne rSerializationM anager
manager, CodeAttachEvent Statement statement)
at
System.Componen tModel.Design.S erialization.Co deDomSerializer Base.Deserializ eStatement(IDes ignerSerializat ionManager
manager, CodeStatement statement)
//

I have made it go away by commenting out the following code. Then I
rebuild, close and reopen the solution.

(This is used within an inherited form thus the Overrides.)
\\
Protected Overrides Sub btnOK_Click(ByV al sender As System.Object,
ByVal e As System.EventArg s) Handles btnOK.Click

'Save to Quote table
InsertIntoQuote ()
'UpdateDatasour ceTable(_dataSe t1.tbl010Quote)

'Save to Version table
insertIntoVersi on()
'UpdateDatasour ceTable(_dataSe t1.tbl020Versio n)

Me.Close()
End Sub
//

What is the problem?

dbuchanan

Dec 9 '05 #1
8 7022
dbuchanan,

What does this error mean?
"The event click is read-only and cannot be changed"

One or more errors encountered while loading the designer. The errors
are listed below. Some errors can be fixed by rebuilding your project,
while others may require code changes.

Have a look at the code in the designerpart, most probably did you change or
delete something in that.
(This can even be because you deleted a class by instance a strongly typed
dataset from your solution explorere).

I hope this helps,

Cor
Dec 9 '05 #2
Cor,

There you go guessing :)

Please read my posts carefully before responding :)

I said
I have made it go away by commenting out the following code. Then I
rebuild, close and reopen the solution.


How coud that work if I had changed or deleted code or deleted a class?

The problem does come back, but not on the first time I run it after
the steps above. It will seem to work okay on the first or second
running, but then it will fail again. The same steps will temporarly
recover the problem, but the problem *will* return.

Anybody have any suggestions regarding why commenting the following
code would temporarly remedy the problem

\\
Protected Overrides Sub btnOK_Click(ByV al sender As System.Object,
ByVal e As System.EventArg s) Handles btnOK.Click

'Save to Quote table
InsertIntoQuote ()
'UpdateDatasour ceTable(_dataSe t1.tbl010Quote)

'Save to Version table
insertIntoVersi on()
'UpdateDatasour ceTable(_dataSe t1.tbl020Versio n)

Me.Close()
End Sub
//

Thank you,
dbuchanan

Dec 9 '05 #3
Copied text until the next line
--------------------------------------------------------------
This is used within an inherited form thus the Overrides.)
\\
Protected Overrides Sub btnOK_Click(ByV al sender As System.Object,
ByVal e As System.EventArg s) Handles btnOK.Click

'Save to Quote table
InsertIntoQuote ()
'UpdateDatasour ceTable(_dataSe t1.tbl010Quote)

'Save to Version table
insertIntoVersi on()
'UpdateDatasour ceTable(_dataSe t1.tbl020Versio n)

Me.Close()
End Sub
//

What is the problem?
------------------------------------------
Problem is probably your "thus". What are you overriding.

This is overriding a btnOK which is probably nowhere created in this class,
not even in your designer part. However AFAIK you are not even able to do
that, what is the reference you had that this is "thus".

Cor.

Dec 9 '05 #4
Hi,

"dbuchanan" <db*********@ho tmail.com> wrote in message
news:11******** *************@g 47g2000cwa.goog legroups.com...
Cor,

There you go guessing :)

Please read my posts carefully before responding :)

I said
I have made it go away by commenting out the following code. Then I
rebuild, close and reopen the solution.
How coud that work if I had changed or deleted code or deleted a class?

The problem does come back, but not on the first time I run it after
the steps above. It will seem to work okay on the first or second
running, but then it will fail again. The same steps will temporarly
recover the problem, but the problem *will* return.

Anybody have any suggestions regarding why commenting the following
code would temporarly remedy the problem

\\
Protected Overrides Sub btnOK_Click(ByV al sender As System.Object,
ByVal e As System.EventArg s) Handles btnOK.Click

----------------------
This looks suspicious.

If the base clase already handles the btnOK.Click event, eg:

Partial Public Class BaseForm
Protected Overridable Sub btnOK_Click(
ByVal sender As System.Object,
ByVal e As System.EventArg s) Handles btnOK.Click
----------------------
' .... code ...
End Sub
End Class

Then the derived class does not need to handle the event ("Handles"), only
override it, eg:

Partial Public Class DerivedForm
Protected Overridable Sub btnOK_Click(
ByVal sender As System.Object,
ByVal e As System.EventArg s)

' ... code that runs before base.btnOK_Clic k here ...

MyBase.btn_OK_C lick(sender, e)

' ... code that runs after base.btnOK_Clic k here ...
End Sub
End Sub

In this example the base class handles the event while the derived class
only overrides it (doesn't handle it again).

If you do handle the event in both the base form and derived form and
override it then this would not cause an Exception but would cause the
eventhandler to fire twice.

The Exception is most likely caused because the btnOK (in the base class)
has no 'protected' Modifier(see btnOK properties) and therefore you can't
add events in the derived class (in VB.Net terms doesn't allow you to use
"Handles"). BUT as explained earlier you probely don't need this event
handling in the derived class because you are already overriden it.
HTH,
Greetings


'Save to Quote table
InsertIntoQuote ()
'UpdateDatasour ceTable(_dataSe t1.tbl010Quote)

'Save to Version table
insertIntoVersi on()
'UpdateDatasour ceTable(_dataSe t1.tbl020Versio n)

Me.Close()
End Sub
//

Thank you,
dbuchanan

Dec 9 '05 #5
Bart,

The exception is not caused because of the modifier because the base
class is modified as "Protected" , however I need to remove the "Handles
btnOK.Click" from the derived class code.

I'll try that and see if I get any errors.

Thank you,
dbuchanan

Dec 9 '05 #6
Hi,

"dbuchanan" <db*********@ho tmail.com> wrote in message
news:11******** *************@g 44g2000cwa.goog legroups.com...
Bart,

The exception is not caused because of the modifier because the base
class is modified as "Protected" ,
Strange, i hope you double checked, anyways at least the oposite is true, if
you Handle an event in a derived form of a base form's Control whose
Modifiers is set to friend, the designer will show the exact same exception.
however I need to remove the "Handles btnOK.Click" from the derived class
code.
Yes, if you use Overridable-Overrides then you only have to Handle the event
once, eg. in the base Form.

Greetings

I'll try that and see if I get any errors.

Thank you,
dbuchanan

Dec 9 '05 #7
Hello Bart,

when I said...
The exception is not caused because of the modifier because the base
class is modified as "Protected" ,


I had misunderstood you. I thought you meant the code as in "Protected
Overridable Sub".
Now I know you meant the modifier in the properties of the button. Yes
it was "Friend". (!)

And now I think I know why the error was "Click is read-only" though it
certainly isn't very clear.

Thanks again,
dbuchanan

Dec 9 '05 #8
Hi,

"dbuchanan" <db*********@ho tmail.com> wrote in message
news:11******** **************@ z14g2000cwz.goo glegroups.com.. .
Hello Bart,

when I said...
The exception is not caused because of the modifier because the base
class is modified as "Protected" ,

I had misunderstood you. I thought you meant the code as in "Protected
Overridable Sub".


no no :-)
Now I know you meant the modifier in the properties of the button. Yes
it was "Friend". (!)
So that was causing the problem then (together with handling the button
event in the derived form).

And now I think I know why the error was "Click is read-only" though it
certainly isn't very clear.
You should also notice that when a base form control modifiers is set to
'Friend' that all properties and events for that control on the derived form
inside the properties window are shown grayed-out, meaning you can't use
them.

But, you can add "Handles" in code, next time you compile and open the
designer, the designer throws because it's trying to change the text of a
grayed-out (readonly) event (in properties window).

Thanks again,
You're welcome.
Greetings

dbuchanan

Dec 9 '05 #9

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

Similar topics

3
9964
by: Marcia Gulesian | last post by:
How can I capture the event when I click with the cursor anywhere in the page (that is, on a component or elsewhere). This event would occure in an I.E 5.5 or later browser.
4
14688
by: Greg Smith | last post by:
I have an old application that analyzes the data in the event log on one of our servers. I would like to convert it to C#. Does anybody know of any examples of reading the event log on a remote system in C#. Any help is greatly appreciated.
3
3052
by: Cooly Martziano | last post by:
Hi, Is there any way in C# that enables me to capture the right click event (on the desktop for example) and add some code of my own on each of these events ? Thanks, Cooly M.
1
2126
by: Greg Smith | last post by:
Hi, I see you can drag and drop a machines event log onto a form. Are there any examples out there of how to read the event log into a table? Any help is greatly appreciated.
0
976
by: fuzz ball | last post by:
G'day I have a ComponentDesigner class that hooks into the DocumentSaved event on the DTE.Document class. This designer is intended to be placed on classes that derive from System.Windows.Forms.UserControl. When the DocumentSaved event fires I would like to iterate through all of the visual controls on UserControl and grab a list of the names of the delegates that have been hooked up each controls events. eg: basically anything that...
2
3374
by: harry | last post by:
Hi I am trying to add an event handler to the window so that If the user clicks the close window button, it creates a popup to tell the user it should use the log out button before closing window. When I try to this: window.captureEvents(Event.CLICK); I get a javascript error saying the "Event" is undefined. Here is how I use the code
1
1107
by: Kay | last post by:
Hello, I am trying to write to the event log from my asp.net application but I get a System.Security.SecurityException exception with the message "Requested registry access is not allowed." String I have followed the suggested solution which is 1. Launch RegEdit
2
1456
by: moi | last post by:
Hello, i would like a sample code to call a button click with the event "textchanged" of a textbox. I just would like to valide a textbox with the textchanged event and not to click on the submit button ... Thanks for your sample .. Bye !
3
1332
by: axxon | last post by:
Hi guys! I am at my wits end detecting which one of the dymically loaded button fired the click event(since they all have same ID and text value) Heres the scenario: I have created a loop to read through the records of a table and creat dynamic buttons. I have also created the button_click event. But in the event handler I can not figure out at which point of the iteration the event was fired!! my code is: ///////////// creating the...
0
1346
by: beginerVB | last post by:
I am able to query/read the "Application" event log using System.Management classes in VB.net 2005 (win xp) But I have problem reading the "Message" / "description" of my custom event log. I am getting a System.NullReferenceException{"Object reference not set to an instance of an object."} while reading the "Message" / "Description of the event log while it is reading the others properties. Also when I use System.Diagnostics.EventLog and...
0
8609
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
9166
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...
0
8871
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...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
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
5861
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
4371
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...
1
3052
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 we have to send another system
2
2333
muto222
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.