| interface implementation and inheritance. |
|
 |
Index ‹ DotNet ‹ Visual C#.Net
|
- Previous
- 1
- 2
- Visual C#.Net >> Release build error LNK2019Hi,
I think it is a FAQ but I found no answer to my problem.
I created a C# program that called some C++ legacy code.
I created 2 projects :
1) a DLL (IPRCommWrapper.dll) including an unmanaged C++ wrapper for
legacy code and a managed C++ wrapper to allow C# to call this unmanaged
wrapper
2) a C# Win application
In Debug mode, everything works fine.
When I try to build in release mode, I have the following error :
"libcmt.lib(crt0.obj) : error LNK2019: unresolved external symbol _main
referenced in function _mainCRTStartup".
here is the output from the build log :
Creating temporary file
"c:\Projects\IPRManaged\IPRCommWrapper\Release\RSP000017.rsp" with
contents
[
/OUT:"C:\Projects\IPRManaged\Release\IPRCommWrapper.dll" /INCREMENTAL:NO
/NOLOGO /DLL /DEBUG
/PDB:"C:\Projects\IPRManaged\Release/IPRCommWrapper.pdb" /NOENTRY
/FIXED:No /noentry nochkclr.obj mscoree.lib pcomm.lib kernel32.lib
user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib
ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib "\Program
Files\Microsoft Visual Studio .NET 2003\Sdk\v1.1\Lib\mscoree.lib"
- 3
- Dotnet >> Output Type missing from Project Properties pageHello,
I'm just learning C# on visual C# .net (my apologies if
this is not the apropriate forum for this question), and
I'm having a problem when I create empty windows
applications. Whenever I create an empty project it
automatically creates it as a console application,
instead of a windows application. There is supposed to
be an "Output Type" property in my project's property
pages that is attached to a compiler switch, but it
simply is not there. All the other properties are -
Assembly Name, Default Namespace, etc. Has anyone else
seen this phenomenon, and does anyone know how to fix
it? I'd really like to create practice programs without
the annoying consule window popping up first.
Thanks,
Nate
- 4
- 5
- Visual C#.Net >> Static Variables.Hi,
I have a pretty basic question.
I have a C# control with lots of classes and I need few instances(manager
classes) shared by all the classes in the conrol. So I define a Static Class
and it works OK.
Now When I want multiple instances of the control in the same application
and each instance to have it own set of manager instances, how do I do it?
Static is shared between the two instance of the control, which I want to
avoid.
Is there a specific variable type or a standard design pattern for it?
Thanks & Regards,
Gobi.
- 6
- ADO >> RecordStateChanged Object reference not set to an instanceObject reference not set to an instance of an object.
at System.Data.DataTable.RecordStateChanged(Int32 record1, DataViewRowState
oldState1, DataViewRowState newState1, Int32 record2, DataViewRowState
oldState2, DataViewRowState newState2)
at System.Data.DataTable.SetNewRecord(DataRow row, Int32 proposedRecord,
DataRowAction action, Boolean isInMerge)
at System.Data.DataRow.SetNewRecord(Int32 record)
at System.Data.DataRow.EndEdit()
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object
value)
at System.Data.DataRowView.set_Item(String property, Object value)
at Lumedx.CardioDoc.UDF.CheckBoxAdapter.checkBox_CheckStateChanged(Object
sender, EventArgs e)
I get the above exception when I try to change the value of a column of a
data row view in the CheckStaeChanged event. The column is the same one the
checkbox's CheckState is bound to.
- 7
- Dotnet >> Plugins and Late BindingHi,
I have some code to load some plug-ins, but the code requires me to know
the name of the class to load (here: SamplePlugin, derived from IPlugin) :
(Here is some C# code, but I use VB.Net to code my program)
using System;
using System.Reflection;
public class Driver
{
static void Main()
{
Assembly assembly = Assembly.LoadFrom ("myplugin.dll");
Type t = assembly.GetType ("SamplePlugin");
IPlugin plugin = (IPlugin) Activator.CreateInstance(t);
plugin.SayHello();
}
}
The problem is, I don't want to have to know the name of the class I want to
load... I want to load the new module and get an instance of the class that
derives IPlugin. Is there a way to do so?
In C++ for the same purpose, I had a win32 dll with an extern function that
returned an instance of the contained class, so I loaded the dll, called the
function and I was ready to proceed. Is there something similar I can do
with .NET class libraries?
thanks
- 8
- Dotnet >> Performance Counter not workingHello,
I wrote an application in c# .net 2.0. The application monitors the network
speed of a networkinterface. If I install the application at another pc with
the .net framework installed, the application won't run. The performance
counter can initialize itself but the value of bytes recieved for example is
always 0.
What should I do? Thanks
- 9
- Visual C#.Net >> Outlook access Pop-upHi,
I have written a console application which accesses
emails stored on outlook and information about them into
SQL Server.
The program works but I have click yes to all the pop-ups
that appear to say another program is trying to access
outlook. Is there a way to stop this pop-up from
appearing as ideally I want to move this application onto
the server to work with exchange instead of the client
outlook.
- 10
- Dotnet >> visual studio update on winserver2003Hi fellows,
I am experiencing a problem while I try to update Visual Studio.NET 2003
on Windows Server 2003.
It tells me tha it is impossibile to connect to the update site. It
doesn't matter if I do it from the Visual Studio menu or from the
windows "add/remove applications" control panel applet.
I suspect it is due to the enhanced protection for Internet Explorer...
I do not want to disable it, I hope there's a way to "trust" Visual
Studio update site...
Windows Update works well...
Any suggestion is greatly appreciated.
Thanks in advance,
Andrea
- 11
- Dotnet >> VS.Net and HTML Form Field Level HelpWe are using Doc-to-Help 6.5 to produce HTML 1.x help for a Visual
Studio.Net Windows application. We want the Help files to remain on our
Intranet server. In my VS.Net project I've added a HelpProvider on each
form. I then set the Namespace to the http location of the .htm file related
to the form. When the user hits F1 voila the .htm page gets displayed in the
IE browser.
My question relates to context-sensitive help at the form field level. Is
there a way to reference the bookmarks within the .htm page (i.e.
http://...form.htm#firstfield) or does each form field need to have a
separate .htm file ? and such do I need to alter the Namespace each time
accordingly? This will place considerable burden on the Doc-to-Help team to
have to manage a file for each form field.
Any assistance in this design issue would be appreciated.
- 12
- Microsoft Project >> Fill "Resource Usage" View using VBAHi,
I'm trying to fill the "Resource Usage" View with some data imported from
Excel or Clipboad.
To figure out how this works I recorded some macros and tried to understand
the vba code generated.
I understand what codelines like the following mean:
ActiveProject.Resources.UniqueID(1).Assignments.UniqueID(2097156).TimeScaleData(StartDate:="18.12.07 00:00", EndDate:="19.12.07
00:00", Type:=8, TimeScaleUnit:=4, Count:=1).Item(1).Value = "8"
But I have no idea how the "Assignments.UniqueID(2097156)" ist generated.
What ist the logic behind this 7-digit number? First I was thinking about a
time- or date-code..
Or is there any other possibility to fill this form, without knowing this
UniqueID 7-digit number?
THX in advance
cu Markus
- 13
- Net Framework >> Application.RunHi
I have an app which starts using Application.Run(...........);
I want to create a logon screen, prior to the main app running, so I
modified my main() to look similar to
frmLogon logon = new frmLogon();
logon.ShowDialog();
//Check for valid logon
// If valid logon, start the main app
Application.Run(new frmMain());
logon=null;
My question is..... why do I need to use Application.Run ??
Should my logon prompt reside IN the application.run form, or outside it??
Thanks
Paul
- 14
- Winforms >> File Open DialogI have a VB2005 program that has to import data from a 3.5 floppy drive and
USB drives. I use a file open dialog to choose the file, works great. The
problem occurs the next time I wish to open a file. If the last import was
done from a floppy drive the program looks for a floppy drive first and if
it has been removed I get an error. While I could just catch the error, I
would rather know how to avoid it. Something similar happens with USB
drives, if I import from a USB drive, the USB drive cannot be safely removed
until the program is ended. The initial directory of the file open dialog
is set to a C drive directory. It just seems that the program is not
releasing the last used drive until the program is exited. Can someone tell
me what I should do?
Thanks,
Thomas
With dlgFileOpen
.InitialDirectory = strAppPath & "Imports\"
.Multiselect = False
.Filter = strFilterExt
.FileName = strDefaultFile
.FilterIndex = 1
.Title = strOpenTitle
.ShowDialog()
End With
funGetFileName = dlgFileOpen.FileNames(0)
--
Posted via NewsDemon.com - Premium Uncensored Newsgroup Service
------->>>>>>http://www.NewsDemon.com<<<<<<------
Unlimited Access, Anonymous Accounts, Uncensored Broadband Access
- 15
- Net Framework >> Can "InitializeComponent()" info be capturedHi there,
Don't know if I picked the correct NGs or not but maybe someone can steer me
in the right direction. Does anyone know if a class exists to capture the
same info now wrapped in "InitializeComponent()". I want to capture all form
details for a given form at design time (properties and controls) but I
can't find anyway to do it. Note that reading a form's ".resx" files won't
do either (it's only good for localized forms but in any case, it doesn't
always provide complete info). Thanks very much.
|
| Author |
Message |
brettdecarion

|
Posted: Wed Mar 26 12:55:00 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
Is it a good idea(or is it possible) for to implement half an
interface in base class and half in derived class.
e.g Interface IMyinterface has 3 properties.
Class B and C inherit class A, and implement implement IMyinteface.
Class A implements Propety1 of the interface IMyinterface
and class B and Class C implement property 2 and 3.
DotNet203
|
| |
|
| |
 |
Peter

|
Posted: Wed Mar 26 12:55:00 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Wed, 26 Mar 2008 10:29:01 -0700, parez <EMail@HideDomain.com> wrote:
> Is it a good idea(or is it possible) for to implement half an
> interface in base class and half in derived class.
No...whichever class declares itself as implementing the interface, that=
=
class must fully implement the interface.
Which is not to say that you can't use the class hierarchy in the =
implementation. A base class can use virtual methods, called by the =
interface implementation, which can be overridden by derived classes. A=
=
derived class can use methods from the base class, again called by the =
interface implementation.
So, using your example:
> e.g Interface IMyinterface has 3 properties.
>
> Class B and C inherit class A, and implement implement IMyinteface.
>
> Class A implements Propety1 of the interface IMyinterface
>
> and class B and Class C implement property 2 and 3.
You might have something like this (showing just two properties here for=
=
brevity):
class A
{
protected int Property1Impl
{
get { ... }
set { ... }
}
}
class B : A, IMyInterface
{
public int Property1
{
get { return Property1Impl; }
set { Property1Impl =3D value; }
}
public int Property2
{
get { ... }
set { ... }
}
}
In that example, only B actually implements the interface, but it inheri=
ts =
an implementation of the interface, used explicitly internally, from A.
Or even something like this:
abstract class A : IMyInterface
{
public int Property1
{
get { ... }
set { ... }
}
public abstract int Property2 { get; set; }
}
class B : A
{
public int Property2
{
get { ... }
set { ... }
}
}
In this example, it's A that implements the interface, but it leaves one=
=
property unimplemented, requiring any derived classes to implement it. =
Of =
course, this means that you can't instantiate A, because it's abstract. =
=
If you want to be able to instantiate A _and_ have it implement =
IMyInterface, obviously it has to have an actual implementation in class=
A.
In that case, a third alternative would be to make the abstract property=
a =
virtual property instead. Then A has a default implementation that othe=
r =
classes can override.
Pete
|
| |
|
| |
 |
Ignacio

|
Posted: Wed Mar 26 12:59:11 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 26, 1:29=A0pm, parez <EMail@HideDomain.com> wrote:
> Is it a good idea(or is it possible) for =A0to implement half an
> interface in base class and half in derived class.
It's possible IF and only IF the base class is abstract. and simply
declare the method of the interface it's implementing (but do not
provide an implementation).
The the devided class must implement the abstract members.
There is no way for the base class to not declare ALL the members of
the inteface
|
| |
|
| |
 |
parez

|
Posted: Wed Mar 26 13:22:14 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 26, 1:55 pm, "Peter Duniho" <EMail@HideDomain.com>
wrote:
> On Wed, 26 Mar 2008 10:29:01 -0700, parez <EMail@HideDomain.com> wrote:
> > Is it a good idea(or is it possible) for to implement half an
> > interface in base class and half in derived class.
>
> No...whichever class declares itself as implementing the interface, that
> class must fully implement the interface.
>
> Which is not to say that you can't use the class hierarchy in the
> implementation. A base class can use virtual methods, called by the
> interface implementation, which can be overridden by derived classes. A
> derived class can use methods from the base class, again called by the
> interface implementation.
>
> So, using your example:
>
> > e.g Interface IMyinterface has 3 properties.
>
> > Class B and C inherit class A, and implement implement IMyinteface.
>
> > Class A implements Propety1 of the interface IMyinterface
>
> > and class B and Class C implement property 2 and 3.
>
> You might have something like this (showing just two properties here for
> brevity):
>
> class A
> {
> protected int Property1Impl
> {
> get { ... }
> set { ... }
> }
> }
>
> class B : A, IMyInterface
> {
> public int Property1
> {
> get { return Property1Impl; }
> set { Property1Impl = value; }
> }
>
> public int Property2
> {
> get { ... }
> set { ... }
> }
> }
>
> In that example, only B actually implements the interface, but it inherits
> an implementation of the interface, used explicitly internally, from A.
>
> Or even something like this:
>
> abstract class A : IMyInterface
> {
> public int Property1
> {
> get { ... }
> set { ... }
> }
>
> public abstract int Property2 { get; set; }
> }
>
> class B : A
> {
> public int Property2
> {
> get { ... }
> set { ... }
> }
> }
>
> In this example, it's A that implements the interface, but it leaves one
> property unimplemented, requiring any derived classes to implement it. Of
> course, this means that you can't instantiate A, because it's abstract.
> If you want to be able to instantiate A _and_ have it implement
> IMyInterface, obviously it has to have an actual implementation in class A.
>
> In that case, a third alternative would be to make the abstract property a
> virtual property instead. Then A has a default implementation that other
> classes can override.
>
> Pete
Thanks.. I am gonna with solution 1.
|
| |
|
| |
 |
parez

|
Posted: Wed Mar 26 15:32:01 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 26, 1:55 pm, "Peter Duniho" <EMail@HideDomain.com>
wrote:
> On Wed, 26 Mar 2008 10:29:01 -0700, parez <EMail@HideDomain.com> wrote:
> > Is it a good idea(or is it possible) for to implement half an
> > interface in base class and half in derived class.
>
> No...whichever class declares itself as implementing the interface, that
> class must fully implement the interface.
>
> Which is not to say that you can't use the class hierarchy in the
> implementation. A base class can use virtual methods, called by the
> interface implementation, which can be overridden by derived classes. A
> derived class can use methods from the base class, again called by the
> interface implementation.
>
> So, using your example:
>
> > e.g Interface IMyinterface has 3 properties.
>
> > Class B and C inherit class A, and implement implement IMyinteface.
>
> > Class A implements Propety1 of the interface IMyinterface
>
> > and class B and Class C implement property 2 and 3.
>
> You might have something like this (showing just two properties here for
> brevity):
>
> class A
> {
> protected int Property1Impl
> {
> get { ... }
> set { ... }
> }
> }
>
> class B : A, IMyInterface
> {
> public int Property1
> {
> get { return Property1Impl; }
> set { Property1Impl = value; }
> }
>
> public int Property2
> {
> get { ... }
> set { ... }
> }
> }
>
> In that example, only B actually implements the interface, but it inherits
> an implementation of the interface, used explicitly internally, from A.
>
> Or even something like this:
>
> abstract class A : IMyInterface
> {
> public int Property1
> {
> get { ... }
> set { ... }
> }
>
> public abstract int Property2 { get; set; }
> }
>
> class B : A
> {
> public int Property2
> {
> get { ... }
> set { ... }
> }
> }
>
> In this example, it's A that implements the interface, but it leaves one
> property unimplemented, requiring any derived classes to implement it. Of
> course, this means that you can't instantiate A, because it's abstract.
> If you want to be able to instantiate A _and_ have it implement
> IMyInterface, obviously it has to have an actual implementation in class A.
>
> In that case, a third alternative would be to make the abstract property a
> virtual property instead. Then A has a default implementation that other
> classes can override.
>
> Pete
I think the separtion of properties works..
I have IMyInterface:interface2
interface2 has property1 defined in it.
and IMyInterface has property2 and property3
Class B implements IMyInterface. and inherits class A
Class A implements interface2.
And this works..
|
| |
|
| |
 |
parez

|
Posted: Wed Mar 26 16:06:02 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 26, 4:32 pm, parez <EMail@HideDomain.com> wrote:
> On Mar 26, 1:55 pm, "Peter Duniho" <EMail@HideDomain.com>
> wrote:
>
>
>
> > On Wed, 26 Mar 2008 10:29:01 -0700, parez <EMail@HideDomain.com> wrote:
> > > Is it a good idea(or is it possible) for to implement half an
> > > interface in base class and half in derived class.
>
> > No...whichever class declares itself as implementing the interface, that
> > class must fully implement the interface.
>
> > Which is not to say that you can't use the class hierarchy in the
> > implementation. A base class can use virtual methods, called by the
> > interface implementation, which can be overridden by derived classes. A
> > derived class can use methods from the base class, again called by the
> > interface implementation.
>
> > So, using your example:
>
> > > e.g Interface IMyinterface has 3 properties.
>
> > > Class B and C inherit class A, and implement implement IMyinteface.
>
> > > Class A implements Propety1 of the interface IMyinterface
>
> > > and class B and Class C implement property 2 and 3.
>
> > You might have something like this (showing just two properties here for
> > brevity):
>
> > class A
> > {
> > protected int Property1Impl
> > {
> > get { ... }
> > set { ... }
> > }
> > }
>
> > class B : A, IMyInterface
> > {
> > public int Property1
> > {
> > get { return Property1Impl; }
> > set { Property1Impl = value; }
> > }
>
> > public int Property2
> > {
> > get { ... }
> > set { ... }
> > }
> > }
>
> > In that example, only B actually implements the interface, but it inherits
> > an implementation of the interface, used explicitly internally, from A.
>
> > Or even something like this:
>
> > abstract class A : IMyInterface
> > {
> > public int Property1
> > {
> > get { ... }
> > set { ... }
> > }
>
> > public abstract int Property2 { get; set; }
> > }
>
> > class B : A
> > {
> > public int Property2
> > {
> > get { ... }
> > set { ... }
> > }
> > }
>
> > In this example, it's A that implements the interface, but it leaves one
> > property unimplemented, requiring any derived classes to implement it. Of
> > course, this means that you can't instantiate A, because it's abstract.
> > If you want to be able to instantiate A _and_ have it implement
> > IMyInterface, obviously it has to have an actual implementation in class A.
>
> > In that case, a third alternative would be to make the abstract property a
> > virtual property instead. Then A has a default implementation that other
> > classes can override.
>
> > Pete
>
> I think the separtion of properties works..
>
> I have IMyInterface:interface2
>
> interface2 has property1 defined in it.
>
> and IMyInterface has property2 and property3
>
> Class B implements IMyInterface. and inherits class A
> Class A implements interface2.
>
> And this works..
The following compiles.. Is this expected behavior?
class A
{
public string prop2
{
get;
set;
}
}
class B : A, Interface1
{
public string prop1
{
get;
set;
}
}
public interface Interface2
{
string prop2 { get; set; }
}
public interface Interface1 : Interface2
{
string prop1 { get; set; }
}
|
| |
|
| |
 |
Peter

|
Posted: Wed Mar 26 17:57:06 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Wed, 26 Mar 2008 14:06:02 -0700, parez <EMail@HideDomain.com> wrote:
> The following compiles.. Is this expected behavior?
Is what "expected behavior?
If you're using C# 3.0, then yes...I don't see any reason what you posted
wouldn't compile. But whether it does what you really want it to do, I
can't say. You haven't declared class A as implementing Interface2, even
though it does appear to. Nor does the code appear to address the
question you originally asked (that is, having the implementation of a
single interface spread across multiple classes).
But if the code does what you want it to do, seems fine to me. :)
Pete
|
| |
|
| |
 |
Jeff

|
Posted: Thu Mar 27 00:37:36 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
Parez... As answered in this thread, it is possible to implement part of
an interface in a base class and complete the implementation in the
derived class. Given an interface ISort:
interface ISort {
void Sort(Array array);
int CompareTo(Object obj);
}
You could write an abstract class that implements a complex Sort
algorithm as in:
abstract class MySortBase : ISort
{
public void Sort(Array array) {
System.Console.WriteLine("Sorted");
} // dummy implementation
public abstract int CompareTo(Object obj);
}
Other coders could then use your complex sort algorithm by inheriting
from MySortBase and implementing the CompareTo method as in:
class MySort : MySortBase
{
public override int CompareTo(object obj)
{
....
}
}
Regards,
Jeff
>Is it a good idea(or is it possible) for to implement half an interface
in base class and half in derived class.<
*** Sent via Developersdex http://www.developersdex.com ***
|
| |
|
| |
 |
parez

|
Posted: Thu Mar 27 08:37:21 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 26, 6:57 pm, "Peter Duniho" <EMail@HideDomain.com>
wrote:
> On Wed, 26 Mar 2008 14:06:02 -0700, parez <EMail@HideDomain.com> wrote:
> > The following compiles.. Is this expected behavior?
>
> Is what "expected behavior?
>
> If you're using C# 3.0, then yes...I don't see any reason what you posted
> wouldn't compile. But whether it does what you really want it to do, I
> can't say. You haven't declared class A as implementing Interface2, even
> though it does appear to. Nor does the code appear to address the
> question you originally asked (that is, having the implementation of a
> single interface spread across multiple classes).
>
> But if the code does what you want it to do, seems fine to me. :)
>
> Pete
Code does address the original question...
Is it a good idea(or is it possible) for to implement half an
interface in base class and half in derived class.
Half (i should have said some) of MyInterface is implemented in
Class A (base class) and half in Class B.
Yes.. It does do what I want it to do..
And why should it work only in c# 3.0? I am using .net 3.0( i think is
c# 2.0)
TIA
|
| |
|
| |
 |
parez

|
Posted: Thu Mar 27 08:40:35 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 27, 1:37 am, Jeff Louie <EMail@HideDomain.com> wrote:
> Parez... As answered in this thread, it is possible to implement part of
> an interface in a base class and complete the implementation in the
> derived class. Given an interface ISort:
>
> interface ISort {
> void Sort(Array array);
> int CompareTo(Object obj);
> }
>
> You could write an abstract class that implements a complex Sort
> algorithm as in:
>
> abstract class MySortBase : ISort
> {
> public void Sort(Array array) {
> System.Console.WriteLine("Sorted");
> } // dummy implementation
> public abstract int CompareTo(Object obj);
> }
>
> Other coders could then use your complex sort algorithm by inheriting
> from MySortBase and implementing the CompareTo method as in:
>
> class MySort : MySortBase
> {
> public override int CompareTo(object obj)
> {
> ....
> }
> }
>
> Regards,
> Jeff>Is it a good idea(or is it possible) for to implement half an interface
>
> in base class and half in derived class.<
>
> *** Sent via Developersdexhttp://www.developersdex.com***
Hi Jeff,
In my example the derived class implemented the interface. I think i
should have made that clear.
Class A -- base class
class B -- derived class
class B: Myinterface
|
| |
|
| |
 |
Peter

|
Posted: Thu Mar 27 10:21:33 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Thu, 27 Mar 2008 06:37:21 -0700, parez <EMail@HideDomain.com> wrote:
> Code does address the original question...
>
> Is it a good idea(or is it possible) for to implement half an
> interface in base class and half in derived class.
I don't see how.
> Half (i should have said some) of MyInterface is implemented in
> Class A (base class) and half in Class B.
Class A implements a method that looks like Interface2, but the class
itself does not implement that interface, nor is that interface also being
implemented (in any way) by Interface1.
If you believe it answers/addresses your question, I guess that's fine.
But I'm not seeing it. I believe that if you feel it does answer your
question, then the question you've stated here is not actually your
question.
> Yes.. It does do what I want it to do..
>
> And why should it work only in c# 3.0? I am using .net 3.0( i think is
> c# 2.0)
The code you posted uses the "automatic property" syntax, which isn't
available in C# 2.0. So if it compiles without error, you must be using
C# 3.0. You can still target earlier versions of .NET with C# 3.0, if
you're using VS 2008, so the .NET version doesn't necessarily tell you
which version of C# you're using.
If you're using VS 2005, then I don't see how the code you posted could
compile.
Pete
|
| |
|
| |
 |
parez

|
Posted: Thu Mar 27 11:39:13 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 27, 11:21 am, "Peter Duniho" <EMail@HideDomain.com>
wrote:
> On Thu, 27 Mar 2008 06:37:21 -0700, parez <EMail@HideDomain.com> wrote:
> > Code does address the original question...
>
> > Is it a good idea(or is it possible) for to implement half an
> > interface in base class and half in derived class.
>
> I don't see how.
>
> > Half (i should have said some) of MyInterface is implemented in
> > Class A (base class) and half in Class B.
>
> Class A implements a method that looks like Interface2, but the class
> itself does not implement that interface, nor is that interface also being
> implemented (in any way) by Interface1.
>
> If you believe it answers/addresses your question, I guess that's fine.
> But I'm not seeing it. I believe that if you feel it does answer your
> question, then the question you've stated here is not actually your
> question.
>
> > Yes.. It does do what I want it to do..
>
> > And why should it work only in c# 3.0? I am using .net 3.0( i think is
> > c# 2.0)
>
> The code you posted uses the "automatic property" syntax, which isn't
> available in C# 2.0. So if it compiles without error, you must be using
> C# 3.0. You can still target earlier versions of .NET with C# 3.0, if
> you're using VS 2008, so the .NET version doesn't necessarily tell you
> which version of C# you're using.
>
> If you're using VS 2005, then I don't see how the code you posted could
> compile.
>
> Pete
Heheh.. May be I mispoke ;)
This is what i want to do with my above listed code
B b = new B();
Interface1 i1 = b;
MessageBox.Show(i1.prop2);
Also I am using VS2008 and target framework is 3.0
|
| |
|
| |
 |
Peter

|
Posted: Thu Mar 27 12:04:07 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Thu, 27 Mar 2008 09:39:13 -0700, parez <EMail@HideDomain.com> wrote:
> Heheh.. May be I mispoke ;)
>
> This is what i want to do with my above listed code
> B b =3D new B();
> Interface1 i1 =3D b;
> MessageBox.Show(i1.prop2);
Seems fine to me. B implements Interface1, which in turn implements =
Interface2, which in turn includes "prop2", which is implemented by A, =
which is inherited by B.
I can't say it's the most obvious, most simple design I've ever run into=
, =
but it should work.
> Also I am using VS2008 and target framework is 3.0
Then I don't see any reason the code you posted wouldn't work. VS 2008 =
=
supports C# 3.0.
Pete
|
| |
|
| |
 |
parez

|
Posted: Thu Mar 27 12:39:24 CDT 2008 |
Top |
Visual C#.Net >> interface implementation and inheritance.
On Mar 27, 1:04 pm, "Peter Duniho" <EMail@HideDomain.com>
wrote:
> On Thu, 27 Mar 2008 09:39:13 -0700, parez <EMail@HideDomain.com> wrote:
> > Heheh.. May be I mispoke ;)
>
> > This is what i want to do with my above listed code
> > B b = new B();
> > Interface1 i1 = b;
> > MessageBox.Show(i1.prop2);
>
> Seems fine to me. B implements Interface1, which in turn implements
> Interface2, which in turn includes "prop2", which is implemented by A,
> which is inherited by B.
>
> I can't say it's the most obvious, most simple design I've ever run into,
> but it should work.
>
> > Also I am using VS2008 and target framework is 3.0
>
> Then I don't see any reason the code you posted wouldn't work. VS 2008
> supports C# 3.0.
>
> Pete
In my case..
A= BaseForm
Interface2 is Error Related stuff.( user error stuff.. things like
missing fields etc.)
All errors are handled the same way.
B=SomeForm
Interface1 represents the fields on that form.
I pass interface1 to a class which populates the form.
SomeClass.PopulateSomeForm(Interface1 form)
|
| |
|
| |
 |
| |
 |
Index ‹ DotNet ‹ Visual C#.Net |
- Next
- 1
- Visual C#.Net >> c# asp.net credit card processingI have just started a project that's going to do very heavy credit card
processing through asp.net and i had some questions. I've never really done
any cc processing through code and I wasn't sure where to get started. Can
anyone suggest a particular gateway or cc processor? I saw a component called
.net charge that seems really promising, has anyone used it?
Have any of you done a full e-commerce site and have some suggestions? What
is best tou use with .net and/or best for the money? The app will have to be
able to bill,refund, and recurring bill. I know I can probably code that
manually if i get the general ideas about how .net cc processing would work.
Thanks for any help.
- 2
- Visual C#.Net >> Regular Expression HelpI've been looking at regular expression examples and can't seem to find what
I am looking to do. Is there a regular expression that can test the following?
1. Contain at least 1 lowercase letter.
2. Contain at least 1 uppercase letter.
3. Contain at least 1 number
4. Contain at least 1 special character (i.e. *, &, %, #, etc).
5. Be at least 8 characters in length
- 3
- Visual C#.Net >> deployment relatedi have created deployment package using setup wizard. In user Interface
editor there are some predefined add dialog box are available. I want to add
new dialog box which is not in add dialog box pane. How to do that. Pls tell
me
- 4
- ADO >> checking for valid connectionHi,
Today we had a thunder storm with lightening/torrental rain the works the
process of which seemed to screw up my 4-port network hub. At the time I was
testing my Windows app which uses a SQL Server database, I changed something
in the UI that required DB access and since by hub had gone it couldn't get
access.
The result was my application hung and I had to use task manager to end it.
So the question is what is the best way to program against this using
VB.NET/ADO.NET?
Have a separate thread that periodically prods the connection to make sure
it's okay, something else?
Regards,
Peter
- 5
- 6
- 7
- Visual C#.Net >> entering an array of numbers into an arraylistThis is a multi-part message in MIME format.
------=_NextPart_000_0006_01C55160.F9C05950
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
I have a situation where a user must enter three int results into three =
textboxes, save that entry and enter another set. All sets have to be =
displayed in another box or grid, and when the collection of data is =
complete, the array of arrays must be saved.
I created an array and populated the elements:
string[] stat =3D new string[3];
stat[0] =3D txt1.Text.ToString();
stat[1] =3D txt2.Text.ToString();
stat[2] =3D txt3.Text.ToString();
And added this array to the arraylist:
stats.Add(new stat());=20
stats.Count tells me that I am adding another array to the list whenever =
I btn_Click
lblResults.Text =3D"The count is: " + stats.Count + "\n";
But I cannot iterate through the arraylist to see the results.
for( i=3D0; i!=3Dstats.Count; i++)
{
string result =3D stats[0].ToString();
lblResults.Text +=3D result + "\n";
}
The question, I think, is how do you unbox and array from an arraylist? =
Or is there a better way to do this? :>)
Many Thanks,
Harry
------=_NextPart_000_0006_01C55160.F9C05950
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Diso-8859-1">
<META content=3D"MSHTML 6.00.2900.2627" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>I have a situation where a user must =
enter three=20
int results into three textboxes, save that entry and enter another set. =
All=20
sets have to be displayed in another box or grid, and when the =
collection of=20
data is complete, the array of arrays must be saved.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT> </DIV>
<DIV><FONT face=3DArial size=3D2><STRONG>I created an array and =
populated the=20
elements:</STRONG></FONT></DIV>
<DIV>
<P><FONT face=3DArial size=3D2>string[] stat =3D new =
string[3];</FONT></P>
<P><FONT face=3DArial size=3D2>stat[0] =3D =
txt1.Text.ToString();</FONT></P>
<P><FONT face=3DArial size=3D2>stat[1] =3D =
txt2.Text.ToString();</FONT></P>
<P><FONT face=3DArial size=3D2>stat[2] =3D =
txt3.Text.ToString();</FONT></P>
<P><FONT face=3DArial size=3D2><STRONG>And added this array to the=20
arraylist:</STRONG></FONT></P><FONT size=3D2>
<P><FONT face=3DArial>stats.Add(</FONT></FONT><FONT face=3DArial><FONT =
color=3D#0000ff=20
size=3D2>new</FONT><FONT size=3D2> stat()); </FONT></FONT></P>
<P><FONT face=3DArial size=3D2>stats.Count tells me that I am adding =
another array=20
to the list whenever I btn_Click</FONT></P><FONT size=3D2>
<P><STRONG>lblResults.Text =3D"The count is: " + stats.Count +=20
"\n";</STRONG></P></FONT>
<P><FONT size=3D2><FONT size=3D3>But I cannot iterate through the =
arraylist to see=20
the results.</FONT></FONT></P><FONT size=3D2><FONT color=3D#0000ff =
size=3D2>
<P><STRONG>for</STRONG></FONT><FONT size=3D2><STRONG>( i=3D0; =
i!=3Dstats.Count;=20
i++)</STRONG></P>
<P><STRONG>{</STRONG></P>
<P></FONT><FONT color=3D#0000ff =
size=3D2><STRONG>string</STRONG></FONT><FONT=20
size=3D2><STRONG> result =3D stats[0].ToString();</STRONG></P>
<P><STRONG>lblResults.Text +=3D result + "\n";</STRONG></P>
<P><STRONG>}</STRONG></P>
<P><FONT face=3DArial>The question, I think, is how do you unbox and =
array from an=20
arraylist? Or is there a better way to do this? :>)</FONT></P>
<P><FONT face=3DArial>Many Thanks,</FONT></P>
<P><FONT face=3DArial>Harry</FONT></P>
<P><FONT face=3DArial></FONT> </P></FONT></FONT>
<P><FONT face=3DArial size=3D2></FONT> </P></DIV></BODY></HTML>
------=_NextPart_000_0006_01C55160.F9C05950--
- 8
- 9
- Net Framework >> Prevent another thread?From a particular WindowsIdentity I need to create a Kerberos token (WSE 2.0)
for a SOAP message:
impersonatedUser = windowsIdentity.Impersonate();
// create Kerberos token
impersonatedUser.Undo();
How can I make sure that other threads does not do stuff while I'm
impersonating on this particular thread? Can I get a list of threads and
pause them all?
Niels
- 10
- Visual C#.Net >> ClickOnce including filesI have an application that is deployed with ClickOnce. The app has uses some
Crystal Reports files but they are not part of the application, but just
stored in a Reports directory. They are not classes within the project.
To display a report, the program
1. Gets a reference to the file from the selection in a dropdown box
2. Creates/instantiates a report document
3. Loads the the report into the document rptDoc.load(<file path>)
4. does some stuff (authentication,parameters, ect)
5. Assigns it as the ReportViewer's report source
works fine, but when I add the rpt files to the project, it wants to treat
them as reports and create a class for each with a code file.
I just need to get the report files copied to the app data directory when
the app is deployed so I don't have to rewrite all the code.
Can anyone suggest how to do this??
tia
Walter
- 11
- Visual C#.Net >> Remove scrollbars from Browser ControlHello,
I am trying to remove the scrollbars from any page I load up into the
browser control on a window form. I first tried the following:
browserDoc = (mshtml.HTMLDocument)browser.Document;
browserBody = (mshtml.HTMLBody)browserDoc.body;
browserBody.scroll = "no";
This worked for most pages but not all. When I navigated to the following
web site:
http://www.levaquinspeakers.com
It still showed the vertical scroll bar although it was disabled since no
scrolling was needed. On sites like http://www.microsoft.com it worked
perfectly. So I did a little research and found people saying that I should
use SetWindowLong API passing it the compliment of WS_VSCROLL and WS_HSCROLL
to turn off the scrollbars. Here is the code I used:
private const int CONST_GWL_STYLE = -16;
private const int CONST_WS_VSCROLL = 0x00200000;
private const int CONST_WS_HSCROLL = 0x00100000;
private const int CONST_SWP_NOSIZE = 0x0001;
private const int CONST_SWP_NOMOVE = 0x0002;
private const int CONST_SWP_NOZORDER = 0x0004;
private const int CONST_SWP_FRAMECHANGED = 0x0020;
private const int CONST_SET_WINDOW_POS_FLAGS = CONST_SWP_NOMOVE |
CONST_SWP_NOSIZE | CONST_SWP_NOZORDER | CONST_SWP_FRAMECHANGED;
//API Calls.
[ DllImport( "user32.dll", EntryPoint = "GetClientRect" ) ]
private static extern int GetClientRect (IntPtr hWnd, ref Rectangle lpRect);
[ DllImport( "user32.dll", EntryPoint = "GetWindowLong" ) ]
private static extern IntPtr GetWindowLongPtr (IntPtr hWnd, int nIndex);
[ DllImport( "user32.dll", EntryPoint = "SetWindowLong" ) ]
private static extern IntPtr SetWindowLongPtr (IntPtr hWnd, int nIndex,
IntPtr dwNewLong);
[ DllImport( "user32.dll", EntryPoint = "SetWindowPos" ) ]
private static extern int SetWindowPos (IntPtr hWnd, IntPtr hWndInsertAfter,
int X, int Y, int cx, int cy, uint uFlags);
IntPtr windowStyle;
int returnValue;
windowStyle = GetWindowLongPtr(browser.Handle, CONST_GWL_STYLE);
windowStyle = new IntPtr(windowStyle.ToInt32() & ~CONST_WS_VSCROLL &
~CONST_WS_HSCROLL);
windowStyle = SetWindowLongPtr(browser.Handle, CONST_GWL_STYLE,
windowStyle);
returnValue = SetWindowPos(browser.Handle, new IntPtr(0), 0, 0, 0, 0,
CONST_SET_WINDOW_POS_FLAGS);
I tried with and without the SetWindowPos call at the end. When I step
through the code I get a proper windowStyle back but it seems the window
already has the WS_VSCROLL and WS_HSCROLL because doing an AND with there
compliments does not change the style at all.
Is there anyway I can get the browser control to reliably remove the
scrollbars? If not is it possible to determine when either the vertical or
horizontal are displayed along with there widths? Thank you for any help you
can provide!!!
Thanks,
Ken
- 12
- Visual C#.Net >> Simple Color Pallete control?I need a simple color pallete control, similar to one that exists in
appearance section in dialog properties. Here is a screenshot:
http://tinyurl.com/y6m78k
I tried using ColorDialog but there doesn't seem to be a way to have only a
couple of colors displayed. Is there a way to customize ColorDialog so that
it only displayes several colors I chose? If not I would appreaciate if
somebody could give me a few pointers on how to create such a control
myself. Thanks in advance.
James
- 13
- Visual C#.Net >> creating mailboxes on exchange 2003 clustersI use C# to connect a database with student information directly to the
Active Directory (2003). This means that as the student is enlisted an
account and mailbox is created in the active directory. Creating users is
flawless en mailbox creating went perfect against a single exhange server
using code from KB article 313114 of which part is displayed below.
mailbox = (IMailboxStore)user.NativeObject;
mailbox.CreateMailbox(homeMDB);
user.CommitChanges();
Now I need to let this code run against an exhange cluster and I can't get
it to work. It gives "There is no such object on the server" errors. I
personally think that somhow the homeMDB url is incorrect. But I can't find
any information on what the differences might be between the path on a
cluster or 'normal' exchange machine. I traced the path using ldap browsers
and it looks to be correct.
Any insights are welcome.
- 14
- Net Framework >> Dotnet 2.0 bug ? Retrieving security permissions of a desktop foldHello,
If I get the ACL of a folder on the desktop, or for example "C:\My
Documents", I do not get the correct security settings. When I check the
security using the properties dialog with the windows explorer the right:
"Read" is true.
But when I check using the code below it returns false because the Read
right is checked twice (the first time it is set to true, the second time it
is set to false ??).
// << code example
DirectoryInfo^ dInfo = gcnew DirectoryInfo("C:\\Documents and
Settings\\USR\\Desktop\\Test2");
DirectorySecurity^ dSecurity = dInfo->GetAccessControl();
AuthorizationRuleCollection^ myAc2 = dSecurity->GetAccessRules(true,
true, SecurityIdentifier::typeid);
for (int j = 0; j < myAc2->Count; j++)
{
AuthorizationRule^ ac2 = myAc2[j];
FileSystemAccessRule^ rule2 = dynamic_cast<FileSystemAccessRule^>(
ac2 );
if ( currentWI->User->Equals(
dynamic_cast<SecurityIdentifier^>(rule2->IdentityReference)) ) {
if ( AccessControlType::Allow.Equals( rule2->AccessControlType ))
{ // THIS is code is reached TWICE when dealing with a 'special'
// folder (desktop or My documents) while with a normal folder
// (say d:\temp) it is reached only once. The first time
bReadRights
// is set to true (OK) but the second time the value of
bReadRights
// is set to false
bool bReadRights = (((int)rule2->FileSystemRights &
(int)FileSystemRights::Read ) == (int)FileSystemRights::Read);
}
}
}
// >> code example
Can anyone help me with this problem ?
Thanks in advance,
martin
- 15
- ADO >> Connection Pool error.I am getting the following SQL exception:
Error: ReadSessionData: Error 1 - Type:
System.Data.SqlClient.SqlException
Source: .Net SqlClient Data Provider
Target Site: System.Data.SqlClient.SqlInternalConnection
GetConnection(Boolean ByRef)
Description: General network error. Check your network
documentation.
Stack Trace: at
System.Data.SqlClient.ConnectionPool.GetConnection
(Boolean& isInTransaction)
at
System.Data.SqlClient.SqlConnectionPoolManager.GetPooledCon
nection(SqlConnectionString options, Boolean&
isInTransaction)
at System.Data.SqlClient.SqlConnection.Open()
at visa.dps.ppc.data.SessionInfoRequest.Execute()
The root seems to be a General network error. Does anyone
know the cause? I can connect with the database with
Enterprise Manager and the database seems intact. I can't
figure out why I am getting this error. It seems to occur
the most when I install a new version of my application.
Once the application runs once without error it seems that
this error goes away. Any ideas?
Thank you.
Kevin
|
|
|