473,396 Members | 1,963 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Windows Form in a Library

Suppose I have a form in a library, say LibForm, and I add a button, say
helpButton, with a modifier of protected.

If I then add a form to a project and change the generated code to read

public partial class MyForm : LibForm
.....

If I go to LibForm and double-click on the 'Click' event for helpButton, it
generates
'private helpButton_Click (..)'

If I double-click on 'Click' event for helpButton in MyForm, it generates
another 'private helpButton_Click' procedure. This is OK.

Don't you think it should generate 'protected helpButton_Click (...)' in
LibForm so I can call it from MyForm ?

Question : If I manually change the private to protected in LibForm, will VS
always leave it so or are there circumstances when it will change it back to
private.

Jun 21 '07 #1
1 1208
Ian Semmel wrote:
Suppose I have a form in a library, say LibForm, and I add a button, say
helpButton, with a modifier of protected.

If I then add a form to a project and change the generated code to read

public partial class MyForm : LibForm
....

If I go to LibForm and double-click on the 'Click' event for helpButton,
it generates
'private helpButton_Click (..)'

If I double-click on 'Click' event for helpButton in MyForm, it generates
another 'private helpButton_Click' procedure. This is OK.

Don't you think it should generate 'protected helpButton_Click (...)' in
LibForm so I can call it from MyForm ?

Question : If I manually change the private to protected in LibForm, will
VS always leave it so or are there circumstances when it will change it
back to private.
Hi Ian,

As far as I can _remember_ VS will leave it alone, after you've created it.

I believe the behaviour you're experiencing, IMHO, is a design decision that
assumes event handlers should be private to the containing class... which
is pretty sensible - as .NET uses a pretty good design pattern for event
management, by means of the 'protected virtual' On* methods, which in turn
raise the events to which they relate.

--
Tom Spink
University of Edinburgh
Jun 22 '07 #2

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

Similar topics

8
by: Ron Holmes | last post by:
I want to place a background image on a windows form. Is there a way to prevent the image from Tiling without using an image box resized to the size of the form? I am using Visual Studio 2003...
7
by: MounilK | last post by:
Hi all, I am not sure if this is the right NG to post this question. If that's the case please point me to the correct NG. I have a class library(myLib.dll) which has a class(myClass) which has...
2
by: Miky | last post by:
Hi, I have the following problem: I have a .CFM web page and I have to populate, from VB, two textboxes on it. I was thinking using sendkeys (even if I don't like it too much) but when I...
3
by: Chris Paul | last post by:
I'm having trouble with PHP & PostgreSQL/OpenLDAP/Apache on Windows. I've set this up countless times on BSD (piece of cake) but I'm trying to do this on Windows now so that my developer can work...
0
by: tony | last post by:
Hello! I have one solution file that consist of three project. One project that build the exe file. One project that build a class library dll One project that build a windows control dll In...
17
by: Jon B | last post by:
Hi All! I have a ASP.NET 2.0 site that works on the Windows 2000 Server. However, when I tried to view this site on my local Windows XP machine, I get "Server Unavailable". If I switch the...
2
by: Iwan Budihalim | last post by:
Dear All, I try to create Windows Control Library and embedded it to my web project. after successfull creating the windows control library and put the control to my web all the control show...
3
FishVal
by: FishVal | last post by:
Windows Script Host Object library. Full name: Windows Script Host Object Model LibName: IWshRuntimeScripting Location: ...\WINDOWS\system32\wshom.ocx The present tip is closely related to...
9
by: Scott Stark | last post by:
Hello, I'm *just* delving into Windows forms-based programming without the benefit of any books, etc. I have a background in light ASP.NET work, so forgive me if this is a really basic question...
4
by: =?GB2312?B?0rvK18qr?= | last post by:
Hi all, Today I was writing a simple test app for a video decoder library. I use python to parse video files and input data to the library. I got a problem here, I need a windows form, and...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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 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.