Can I have an Event & Method with the same name in the same class? I want
to have a "Close" method to close a socket and a "Close" event to be raised
when the socket is closed. 5 1330
"Terry Olsen" <to******@hotma il.com> wrote in message
news:uD******** ******@tk2msftn gp13.phx.gbl... Can I have an Event & Method with the same name in the same class? I want to have a "Close" method to close a socket and a "Close" event to be
raised when the socket is closed.
Even if you could, it's not a good idea. Why chance the unneccessary
confusion when you can use a similar meaningful name instead - SocketClosed,
CloseSocket, etc?
Why not call them something like
MyMethodName
MyMethodNameEve nt
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"Ged Mead" <ge*********@te sco.net> wrote in message
news:Zz******** **@newsfe1-gui.ntli.net... "Terry Olsen" <to******@hotma il.com> wrote in message news:uD******** ******@tk2msftn gp13.phx.gbl... Can I have an Event & Method with the same name in the same class? I want to have a "Close" method to close a socket and a "Close" event to be raised when the socket is closed.
Even if you could, it's not a good idea. Why chance the unneccessary confusion when you can use a similar meaningful name instead - SocketClosed, CloseSocket, etc?
The reason I asked is because I am trying to write a "WinSock" class with
the same properties, methods, and events as the VB6 WinSock Control, which
has the same name for the Close Event & Method.
"Ged Mead" <ge*********@te sco.net> wrote in message
news:Zz******** **@newsfe1-gui.ntli.net... "Terry Olsen" <to******@hotma il.com> wrote in message news:uD******** ******@tk2msftn gp13.phx.gbl... Can I have an Event & Method with the same name in the same class? I want to have a "Close" method to close a socket and a "Close" event to be raised when the socket is closed.
Even if you could, it's not a good idea. Why chance the unneccessary confusion when you can use a similar meaningful name instead - SocketClosed, CloseSocket, etc?
The answer is no. You cannothave the same identifier for two different
types. With functions and subs though you can overload the identifier as
long as the signatyures are different.
--
OHM ( Terry Burns ) * Use the following to email me *
Dim ch() As Char = "ufssz/cvsotAhsfbuTpmv ujpotXjui/OFU".ToCharArra y()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar( Convert.ToInt16 (ch(i)) - 1)
Next
Process.Start(" mailto:" & New String(ch))
--
"Terry Olsen" <to******@hotma il.com> wrote in message
news:eJ******** ******@TK2MSFTN GP12.phx.gbl... The reason I asked is because I am trying to write a "WinSock" class with the same properties, methods, and events as the VB6 WinSock Control, which has the same name for the Close Event & Method.
"Ged Mead" <ge*********@te sco.net> wrote in message news:Zz******** **@newsfe1-gui.ntli.net... "Terry Olsen" <to******@hotma il.com> wrote in message news:uD******** ******@tk2msftn gp13.phx.gbl... Can I have an Event & Method with the same name in the same class? I want to have a "Close" method to close a socket and a "Close" event to be raised when the socket is closed.
Even if you could, it's not a good idea. Why chance the unneccessary confusion when you can use a similar meaningful name instead - SocketClosed, CloseSocket, etc?
Terry, Can I have an Event & Method with the same name in the same class?
No as they are both at the same scope.
I want to have a "Close" method to close a socket and a "Close" event to be raised when the socket is closed.
I would call the event Closed, while calling the method Close. (which btw is
what you stated :-))
If I needed an event that occurred when the connection was about to close I
would call it Closing.
Which is what the "Design Guidelines for Class Library Developers"
recommends: http://msdn.microsoft.com/library/de...Guidelines.asp http://msdn.microsoft.com/library/de...Guidelines.asp
Hope this helps
Jay
"Terry Olsen" <to******@hotma il.com> wrote in message
news:uD******** ******@tk2msftn gp13.phx.gbl... Can I have an Event & Method with the same name in the same class? I want to have a "Close" method to close a socket and a "Close" event to be raised when the socket is closed.
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: ian justice |
last post by:
Before i post actual code, as i need a speedyish reply.
Can i first ask if anyone knows off the top of their head, if there is
a likely obvious cause to the following problem.
For the moment i've reduced my form request to a simple text string
entry, instead of my desired optional parameters. As i have been stuck
with a single unfathomable glitch for over a year.
Basically, if i enter queries such as ;
"select * from table" "select * from...
|
by: Alexey V. Dmitriev |
last post by:
Hi, ALL!
Try to parse my XML doc with Xerces2-J (v.2.2.0), but ErrorHandler
return errors a course of this proccess. All needed features were turn
on. BTW, validation under XMLSpy tool passed successfully. What's
wrong? Really these two tools (Xerces and XMLSpy) work on
miscellaneous? Below the fragment of the scheme and XML-data itself
are given.
=================My XML Schema===================
<?xml version="1.0" encoding="UTF-8"?>...
|
by: Thomas Scheffler |
last post by:
Hi,
I runned in trouble using XALAN for XSL-Transformation.
The following snipplet show what I mean:
<a href="http://blah.com/?test=test&test2=test2">Test1&</a>
<a href="http://blah.com/?test=test&amp;test2=test2">Test2&amp;</a>
This results in the following HTML Code:
|
by: The Alchemist |
last post by:
I am having a problem with a dynamically-generated Datagrid. It is
important to point out that this problem does not exist with a
design-time created Datagrid, but only with a dynamically generated
Datagrid in a Web Custom Control (WCC) :
The datagrid has LinkButton Column which has a select LinkButton for
each row. When this button is clicked, the Datagrid raises its
'ItemCommand' event which captures the information for that row and...
|
by: Perry van Kuppeveld |
last post by:
Hi,
I would like to submit a form through scripting, and still retrieve the
click event on the server.
See code below to test some stuff.
Create a C# webapplication and replace the WebForm1 class with the code
below.
While running the program, give the textarea the focus and press enter. See
the dif with clicking submit.
| |
by: comzy |
last post by:
I have created an event bubbling for my pager control which is used for
implementing paging in data grid. Althoug it worked very fine in .NET
1.1 it is throwing the following error after i migrated it to .NET 2.0
The peculiar thing abou that is it is throwing error only in IE 6.0 and
it works fine in netscape, firefox, opera even after converting it to
..NET 2.0
Can anyone tell me whether anything has changed in event bubbling
format...
|
by: Nathan Sokalski |
last post by:
I add a JavaScript event handler to some of my Webcontrols using the
Attributes.Add() method as follows:
Dim jscode as String = "return (event.keyCode>=65&&event.keyCode<=90);"
TextBox2.Attributes.Add("onKeyPress", jscode)
You will notice that jscode contains the JavaScript Logical And operator
(&&). However, ASP.NET renders this as && in the code that is
|
by: Neo Geshel |
last post by:
I have strip-mined, strip-searched, and completely exhausted the
Internet (up to the 30th page on Google, with 100 results per page!!),
all without finding an answer to my question AS TO WHY IT IS IMPOSSIBLE
TO PROGRAMMATICALLY ADD A BUTTON TO A DYNAMICALLY CREATED PAGE.
Or, to be more precise, why it is impossible to have an onClick sub
respond to that button’s Click event.
My main page has only one line:
|
by: Slickuser |
last post by:
From my PHP page:
Grab all data from the database.
Go through a loop to generate the HTML.
Client side:
From the Color drop menu list, if a user change the value. It will
grab that value & update to the database based on the hidden ID.
DELETE ALL will delete everything the databse.
|
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,...
|
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...
| |
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,...
|
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...
|
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...
|
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();...
|
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
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |