473,320 Members | 2,117 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,320 software developers and data experts.

Help understanding why compiler needs to qualify one method and not the other.

I have two projects each with a different namespace. The first defines an
interface with two methods.

namespace SWPStandards

{

public interface ISWPDisplayMessage

{

void DisplayMessage(string message);

void DisplayMessage(string message, bool popUp);

}

}

the second implements the interface.

namespace BRBWinTester

{

public class Form1 :
System.Windows.Forms.Form,ISWPDisplayMessage,ISWPH andleException

{

...

public void DisplayMessage(string message, bool popUp)

{

statusBar1.Text = message;

if (popUp)

MessageBox.Show(message);

}

void DisplayMessage(string message)

{

DisplayMessage(message,SWP.Const.NoPopUP);

}

}

}

I have implemented the two required methods one both without qualifying the
method with SWPStandards.ISWPDisplayMessage. Why does the compiler generate
the following exception?

'BRBWinTester.Form1' does not implement interface member
'SWPStandards.ISWPDisplayMessage.DisplayMessage(st ring)'.
'BRBWinTester.Form1.DisplayMessage(string)' is either static, not public, or
has the wrong return type.

Why doesn't it generate the same message for the other method?

Any assistance would be appreciated.
Nov 15 '05 #1
4 1241
in your code, in the class implementing the interface, the first method is
public, the second is not ... the problem is not on FQN for the methods, but
ob the modifier ...

an interface only lists public methods.
by default, members of a class are protected.

"Ben R. Bolton" <ns****@xbridgesystems.com> wrote in message
news:O8****************@TK2MSFTNGP09.phx.gbl...
I have two projects each with a different namespace. The first defines an
interface with two methods.

namespace SWPStandards

{

public interface ISWPDisplayMessage

{

void DisplayMessage(string message);

void DisplayMessage(string message, bool popUp);

}

}

the second implements the interface.

namespace BRBWinTester

{

public class Form1 :
System.Windows.Forms.Form,ISWPDisplayMessage,ISWPH andleException

{

..

public void DisplayMessage(string message, bool popUp)

{

statusBar1.Text = message;

if (popUp)

MessageBox.Show(message);

}

void DisplayMessage(string message)

{

DisplayMessage(message,SWP.Const.NoPopUP);

}

}

}

I have implemented the two required methods one both without qualifying the method with SWPStandards.ISWPDisplayMessage. Why does the compiler generate the following exception?

'BRBWinTester.Form1' does not implement interface member
'SWPStandards.ISWPDisplayMessage.DisplayMessage(st ring)'.
'BRBWinTester.Form1.DisplayMessage(string)' is either static, not public, or has the wrong return type.

Why doesn't it generate the same message for the other method?

Any assistance would be appreciated.

Nov 15 '05 #2
Malek,
Thanks for you quick response. Unfortunately that is not the issue.
Changing method drfinition to
public void DisplayMessage(string message)

{

DisplayMessage(message,SWP.Const.NoPopUP);

}

generates the same error.
Ben
"Malek" <ke****@arrabeta.com> wrote in message
news:ee****************@TK2MSFTNGP09.phx.gbl...
in your code, in the class implementing the interface, the first method is
public, the second is not ... the problem is not on FQN for the methods, but ob the modifier ...

an interface only lists public methods.
by default, members of a class are protected.

"Ben R. Bolton" <ns****@xbridgesystems.com> wrote in message
news:O8****************@TK2MSFTNGP09.phx.gbl...
I have two projects each with a different namespace. The first defines an interface with two methods.

namespace SWPStandards

{

public interface ISWPDisplayMessage

{

void DisplayMessage(string message);

void DisplayMessage(string message, bool popUp);

}

}

the second implements the interface.

namespace BRBWinTester

{

public class Form1 :
System.Windows.Forms.Form,ISWPDisplayMessage,ISWPH andleException

{

..

public void DisplayMessage(string message, bool popUp)

{

statusBar1.Text = message;

if (popUp)

MessageBox.Show(message);

}

void DisplayMessage(string message)

{

DisplayMessage(message,SWP.Const.NoPopUP);

}

}

}

I have implemented the two required methods one both without qualifying the
method with SWPStandards.ISWPDisplayMessage. Why does the compiler

generate
the following exception?

'BRBWinTester.Form1' does not implement interface member
'SWPStandards.ISWPDisplayMessage.DisplayMessage(st ring)'.
'BRBWinTester.Form1.DisplayMessage(string)' is either static, not

public, or
has the wrong return type.

Why doesn't it generate the same message for the other method?

Any assistance would be appreciated.


Nov 15 '05 #3
compiles fine when I try it ... did you close and reopen VS ?

"Ben R. Bolton" <ns****@xbridgesystems.com> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
Malek,
Thanks for you quick response. Unfortunately that is not the issue.
Changing method drfinition to
public void DisplayMessage(string message)

{

DisplayMessage(message,SWP.Const.NoPopUP);

}

generates the same error.
Ben
"Malek" <ke****@arrabeta.com> wrote in message
news:ee****************@TK2MSFTNGP09.phx.gbl...
in your code, in the class implementing the interface, the first method is
public, the second is not ... the problem is not on FQN for the methods, but
ob the modifier ...

an interface only lists public methods.
by default, members of a class are protected.

"Ben R. Bolton" <ns****@xbridgesystems.com> wrote in message
news:O8****************@TK2MSFTNGP09.phx.gbl...
I have two projects each with a different namespace. The first
defines an interface with two methods.

namespace SWPStandards

{

public interface ISWPDisplayMessage

{

void DisplayMessage(string message);

void DisplayMessage(string message, bool popUp);

}

}

the second implements the interface.

namespace BRBWinTester

{

public class Form1 :
System.Windows.Forms.Form,ISWPDisplayMessage,ISWPH andleException

{

..

public void DisplayMessage(string message, bool popUp)

{

statusBar1.Text = message;

if (popUp)

MessageBox.Show(message);

}

void DisplayMessage(string message)

{

DisplayMessage(message,SWP.Const.NoPopUP);

}

}

}

I have implemented the two required methods one both without

qualifying the
method with SWPStandards.ISWPDisplayMessage. Why does the compiler

generate
the following exception?

'BRBWinTester.Form1' does not implement interface member
'SWPStandards.ISWPDisplayMessage.DisplayMessage(st ring)'.
'BRBWinTester.Form1.DisplayMessage(string)' is either static, not

public,
or
has the wrong return type.

Why doesn't it generate the same message for the other method?

Any assistance would be appreciated.



Nov 15 '05 #4
Makek,

Well closing and reopening the IDE solved the problem (grumble grumble)..
Thanks for you help.

Ben

"Malek" <ke****@arrabeta.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
compiles fine when I try it ... did you close and reopen VS ?

"Ben R. Bolton" <ns****@xbridgesystems.com> wrote in message
news:ud**************@TK2MSFTNGP10.phx.gbl...
Malek,
Thanks for you quick response. Unfortunately that is not the issue.
Changing method drfinition to
public void DisplayMessage(string message)

{

DisplayMessage(message,SWP.Const.NoPopUP);

}

generates the same error.
Ben
"Malek" <ke****@arrabeta.com> wrote in message
news:ee****************@TK2MSFTNGP09.phx.gbl...
in your code, in the class implementing the interface, the first
method
is public, the second is not ... the problem is not on FQN for the
methods,
but
ob the modifier ...

an interface only lists public methods.
by default, members of a class are protected.

"Ben R. Bolton" <ns****@xbridgesystems.com> wrote in message
news:O8****************@TK2MSFTNGP09.phx.gbl...
> I have two projects each with a different namespace. The first

defines
an
> interface with two methods.
>
>
>
> namespace SWPStandards
>
> {
>
> public interface ISWPDisplayMessage
>
> {
>
> void DisplayMessage(string message);
>
> void DisplayMessage(string message, bool popUp);
>
> }
>
>
>
> }
>
>
>
> the second implements the interface.
>
>
>
> namespace BRBWinTester
>
> {
>
> public class Form1 :
> System.Windows.Forms.Form,ISWPDisplayMessage,ISWPH andleException
>
> {
>
> ..
>
> public void DisplayMessage(string message, bool popUp)
>
> {
>
> statusBar1.Text = message;
>
> if (popUp)
>
> MessageBox.Show(message);
>
> }
>
>
>
> void DisplayMessage(string message)
>
> {
>
> DisplayMessage(message,SWP.Const.NoPopUP);
>
> }
>
>
>
> }
>
> }
>
>
>
> I have implemented the two required methods one both without

qualifying the
> method with SWPStandards.ISWPDisplayMessage. Why does the compiler
generate
> the following exception?
>
>
>
>
>
> 'BRBWinTester.Form1' does not implement interface member
> 'SWPStandards.ISWPDisplayMessage.DisplayMessage(st ring)'.
> 'BRBWinTester.Form1.DisplayMessage(string)' is either static, not

public,
or
> has the wrong return type.
>
>
>
> Why doesn't it generate the same message for the other method?
>
>
>
> Any assistance would be appreciated.
>
>



Nov 15 '05 #5

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

Similar topics

22
by: Jeff Louie | last post by:
Well I wonder if my old brain can handle threading. Dose this code look reasonable. Regards, Jeff using System; using System.Diagnostics; using System.IO; using System.Threading;
11
by: dhnriverside | last post by:
Hi peeps Ok, so I thought I'd have a go at making a console app in VS2k5... I haven't written any windows apps for years, let alone dos apps (been web programming) and I've hit a dumb error... ...
2
by: SStory | last post by:
Here is the situation. I want to display Icons, Type of file etc from a file extension. Upon initial program load I may only need icons for certain files. But other operations will require...
7
by: pbd22 | last post by:
hi. i am having probs understanding how to grab a file being uploaded from a remote client. i am using hidden input fields for upload such as: <input id="my_file_element" type="file"...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
4
by: Andrew Taylor | last post by:
Hi, I've been using PHP for a long time, I have designed and developed a number of mid-range systems. I've always used a procedural approach. I fully understand the concept of OO, I know all the...
9
by: igor.kulkin | last post by:
References is a relatively basic feature of C++ language. It might be a good thing to think of references as aliases to the variables. However it's good to think of references this way when you...
5
by: sajin | last post by:
Hi All.. We are using VB .Net 2005 for implementing an API. API needs to generate events. For this client wants us to use Windows Callback (delegate implementation). The intention of using...
0
by: akshaycjoshi | last post by:
I am reading a book which says Even though unboxed value types don't have a type object pointer, you can still call virtual methods (such as Equals, GetHashCode, or ToString) inherited or...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.