What Is An Interface
Nov 1, 2009give me some more detail on the benefit of using an interfaces.
View 8 Repliesgive me some more detail on the benefit of using an interfaces.
View 8 Replieshow to create a user interface in a game such as the application XFire using Visual Basic?
View 3 RepliesI'm working on a design project where I have to use a Graphical User Interface that contains a drag and drop form. It consists of having a window dropped on a wall. Both of them are images to scale. I would like to know what kind of code I would have to use to show the x and y coordinates of one of the points of my window when dragged so when I drop it, I'm dropping in it on the desired coordinate of the wall.
View 2 RepliesI was wondering if I could elicit some tips on how to procede with an interface design approach.That is. What is a good way to go about establishing a "work area" where one can have multiple "floating forms" in this area.Can you have a form which occupies the entire windows desk top and the other forms "float" in this space? the "floating" forms would need to interact with each other where pressing buttons etc on them would affect other forms on the "workspace") Or what would be a good way to start accomplishing that? Or is there a better way to get the same effect?
View 4 RepliesI'm trying to make a .dll that contains a lot of basic functionality that a program can use. Currently i am trying to use interfaces to make a lot of this functionallity independend of the program using it but i hit a snag. The Basic idea is that a programmer will create his own object using the interface discribed in my .DLL file. Then implements those functions as he likes. He can then instanciate a controller (found in the same DLL) and sends his custom object implementing the interface to that Controller. The controller can then be started and will take over all the work. I do not know what type of object is send to the controller and idealy i want to program it in such a fashion that i shouldn't care as long as the object send implements that interface.In code I am trying to achieve the following: (quite simplyfied)
.Dll:
Code:
Public Interface MyInterface '<----Decleration of the interfaceFunction GetData() As Integer
Function SetData(Data As Integer)
end interface
[code]....
this propperly. I know that the second i set the interface adaptor in the Controller VS comes nagging that it can not be converted to a "MyInterface" Class. Obviously i am doing something wrong. I can change the datatype that the controller expects to the "MyController" type but that would completely ruin the whole idea of flexibillity. I am hoping someone sees what i am trying to do and can point out where i made the thinking error.
Is this where i would post a picture of my interface and get feedback on changes for easier use? If not is there someplace on this forum or any other forum to do this?
View 1 Repliesin the codebase i'm maintaining there is an old interface. Let's call it IFoo. It pretty much became obsolete and replaced with the Interface INewFoo with a change a few weeks ago, but for backwards-compatibility purposes, i wrote a wrapper class which implements INewFoo and takes an IFoo in the constructor.To clarify, consider the following code.
Public Interface IFoo
Sub DoStuff()
End Interface[code].....
For both interfaces, the implementations are loaded by scanning a few assemblies with StructureMap. Now, let's get to the bad things. Most implementations for the old interface were put into forms for reason i can neither understand nor change. Because those tend to be displayed and disposed, i have to create a new instance every time i use ObjectFactory.GetAllInstances(Of IFoo). Thats still no problem, but i'd like to register a INewFoo-Wrapper for each registered implementation of IFoo, so that i can just use ObjectFactory.GetAllInstances(of INewFoo) and get all implementations of IFoo AND INewFoo.I can't iterate through the implementations of IFoo and register a wrapper for each one because as far as i can see, you can just register those with instances.Wrong code below:
ObjectFactory.Configure(Sub(config)
config.Scan(Sub(scan)
For Each ass In assemblies[code].....
My question is: Is it possible to register a wrapper for each implementation of IFoo which always creates a new instance of the implementation before creating a new instance of the wrapper?
I want to declare a property as an interface collection of an interface, and I want to instanciate the explicit type later, in the constructor. Something like this.
Public Class LicenseFile
Implements ILicenseFile
Public Property Collection As IList(Of ILicenseFileDataNode)
[Code]....
In short, the question is "Why It Didn't work"? This is a simplified scenario, but It's easy to take a workarround, But I need understand the reason because It's fails.
I'm using interface with relay and interface is connected to computer on COM (serial) 9 pins port. In Visual Studio 2005 I'm using this
SerialPort1.Open
SerialPort1.DtrEnable = True
SerialPort1.Breakstate = True
[code].....
Why does an interface override a class definition and violate class encapsulation? I have included two samples below, one in C# and one in VB.net?
[Code]...
I have an interface class (IUser) which is the interface of class User. Now, i want to put these into an IList but am confused as to how i should declare the IList:Dim userList As IList(Of IUser) = New List(Of IUser) Dim userList As IList(Of User) = New List(Of User) Dim userList As IList(Of IUser) = New List(Of User) Dim userList As IList(Of User) = New List(Of IUser) when instantiating should you always use its implementation; and when using it as a type use its interface?
And when im creating a new user should i use: Dim myUser as IUser = new User?
Can an Interface contain an Enum?I am using asp.net 2.0. Suddenly my code started having problems when I added an enum to the interface below. In it, LookUpType is an enum.
Public Interface ILookup
Property ID() As Int32
Property Text() As String
[code]....
I have a control that overrides the protected GetService method and assigns it to the IServiceProvider interface:
Class MyControl
Inherits Control
Implements IServiceProvider
[Code].....
I'm struggling to convert this to c#. I've tried implicit v. explicit but I must be getting the syntax wrong.
Let me give a scenario then see if anyone has a solution / work-around.I've got a library (DLL) that contains only classes. In another library, I've got interfaces that the classes in the first library implement. Clients will always reference only one version of the library containing the interfaces (always the latest one) - and only additions will be made to those interfaces (more interfaces / methods). Also, there will only be one version of that interfaces library - so that clients don't need to update references (the interfaces library will be loaded through reflection - so the usual probing rules do not apply, we can only load what the client specifically asks for). The library implementing the interfaces will have multiple versions that different clients reference at the same time.
The problem occurs when a client assembly is referencing an old version of the implementation library. It creates an object from a class type in the implementation library - then passes it to another client assembly. That client assembly uses the latest (and only) version of the interfaces library and attempts to cast the object passed to it with the appropriate interface type. This cast fails with the exception 'System.TypeLoadException: Method X in type Y from assembly Z does not have an implementation'. I expected this exception because in the new version of the interface (same version number - old library clobbered), method X is defined, but even though the old version of the object that is passed contains metadata that says it implements the corresponding interface, the mapping fails on the new interface method X because it doesn't have any implementation in that class.
So, my question is this; Is there a way to have a client use that interface, but only cause an exception when a method that is not implemented on the referenced object is called (rather than the exception being generated when the referenced object is cast to the newer interface type)?By the way - late binding isn't an option because we want intellisense / compile time type checking ... Also, I know how to do this with function pointers and wrapper classes - I was just hoping for a better solution that is more in tune with regular .NET types.
How can i add MenuStrip Look Like Below picture ? My MenuStrip is below picture :
View 1 RepliesQuestion: I have a mailserver written in C# and want to add a web-interface.Now the way I see it, there are two possibilities:
1) Somebody want's to integrate the mailserver on his own webpage/webapp --> needs WebService interface
2) Somebody wants to access the mailserver via a web-interface, e.g. on localhost for configuration, but maybe also for writing and reading email.
What's the best way to unify these 2 demands?I mean with 2), the mailserver basically needs his own webserver, listening on port 80 or n, where it displays a page that e.g. ideally uses the WebService to integrate the webserver funcionality into the integrated webserver-webpage.But said integrated webserver should not interfere with an ordinary webserver,if running on that machine.Also there is the problem of ports and firewalls on the client side and in corporate networks.
In my program I have an interface iGraphable that contains two properties: Abscissa and Ordinate. Then I have an xxxx class (actually more than one) implementing iGraphable and a ListOfxxxx class implementing BindingListView(Of xxxx).To draw graphs I have a Graph class with a property called Data whose type is BindingListView(of iGraphable).Why have I a cast exception when I pass a BindingListView(Of xxxx) to the Data property.
View 3 RepliesI am trying to implement an interface defined in IDL, in a vb.net class here is the idl
interface IEmissaryRoot : IDispatch {
id(0x68030000), propget]
out, retval] IActivityCol** );
[code]....
Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.VisualStudio.OLE.Interop.IServiceProvider'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{6D5140C1-7436-11CE-
[code].....
i am warsame Essa Mohamed life in Hargeisa Somaliland.
design of vb interface to be the best?
in order for me to get help on me and my programming partners vb6 rpg, I have to upgrade the project to the vb.net platform, and I am worried that the IDE interface that is used to program the vb side of the rpg is different, so I am wanting to ask any of you if there are any significant changes to the IDE or if it is relatively the same as it was in vb6... I am also hoping that someone here can also help me to see what is wrong with my load/save function... I now thought of something to try to see if that is the issue or not, but the code is still vb6 code, the only difference will be that the program will be upgraded to the .net platform, so if that changes anything in the code, then I am not aware of this as of yet, because I am still downloading the visual studios 2010 express iso right now... so I do not know for sure yet what will be changed.
View 3 RepliesI'm thinking of having a flash interface in my program..I'm using visual basic 2008.Can you give some example code,tutorials or program that has flash interface.
View 1 Repliescurrently i have vb express 2008vb interfacenow id like to study how to program in vb.netmy current interface is in vb application (controls etc)
View 10 Repliesi am currently doing a program to control some device via usb port but i don't know how to interface the usb port using vb.net.this is code in vb.6.but i don't know how to changethis code into vb.net.
Private Sub Command4_Click()
Dim id As Integer
Dim status As Integer
[code].....
Does anybody have an example of how to rip a cd using the iwmpcdrom interface with vb.net?It can be ripped either as wave or MP3s (though as MP3s would be better stoarge wise and would save me having to convert waves to MP3s using Lame (although I'm already doing that bit).
View 5 RepliesI'm trying to assign a datasource to a ComboBox control during runtime. When I do so, I get the attached message. [Code] I want to learn how to use an Interface. The error message is suggesting using an IList. How would I do this.
View 2 RepliesActually i am a new user for this software, so i am seeking some helps from you guys to assist me in my project. My problem is i dont know how to interface between visual basic(studio 2008) with usb cable.
View 1 RepliesIs it possible to create a VB6 interface that can be implemented in a .NET class? I have the need to call a method in an existing VB6 class that behind the scenes will call either a VB6 or .NET class that utilize the same interface.
MyObject.Type = "clsVB6"
MyObject.DoSomething(intID)
would behind the scenes be utilizing a VB6 class that implemented a 'DoSomething' VB6
[code]....
I need to call a function that takes an array of drive letters as one of its arguments. The sample I received from the dev team that created the object uses VBScript and looks like this:
Array("C:","D:")
This doesn't work in VB.NET so I tried the following code. Note: The drives are passed to me in a comma separated string:
Dim drives As String = "C,D"
Dim volumeList As String() = drives.Split(","c)
For i As Integer = 0 To volumeList.Length - 1
volumeList(i) &= ":"
Next
Then I try to pass volumeList to the function in question and I get an invalid argument exception. Is there some other way I could try to create/pass this array so that it acts like the VBScript example?
I need to implement the IBindableComponent to the the following code:
Public Class InfragisticsToolStripBindableButton
Inherits Infragistics.Win.UltraWinToolbars.ButtonTool
Implements IBindableComponent
[CODE]...
1 problem: Warning: event 'Disposed' conflicts with property 'Disposed' in the base class 'DisposableObject' and should be declared 'Shadows'
2 problem: Error: Class 'InfragisticsToolStripBindableButton' must implement 'Property Site As ISite' for interface 'System.ComponentModel.IComponent'. Implementing property must have matching 'ReadOnly' or 'WriteOnly' specifiers.
Why should I implement "IComponent" if I implement "IBindableComponent"?
3 problem: How should I override "Dispose", if it's already implemented in the base class, but is not virtual apparently.