3 Values To The Serial Interfaces
May 1, 2009I have a program written in Visual Studio to me 3 values ( 0-255, 0-255, 0-255) to send the serial interfaces, and While assigned to the 3 values of 3 sliders together.[code...]
View 1 RepliesI have a program written in Visual Studio to me 3 values ( 0-255, 0-255, 0-255) to send the serial interfaces, and While assigned to the 3 values of 3 sliders together.[code...]
View 1 RepliesI want to send hex values across the serial port. I know, I know, your thinking not this again. But what I need to do does not seem to be addressed, or I am some how missing it when I search around.
[Code]...
I have a bunch of serial time values, like these:
0,475694444444444
0,463888888888889
0,54375
0,584027777777777
Is there a function in vb.NET that can convert these values to hh:mm:ss, or something more readable than those values?
I have writen a piece of software which takes values from a serial port, peforms some calculations and then records the result in an Excel file.It also uses some values stored in an excel file for reference.
The program will run fine for days/weeks until the PC is rebooted mid run.Once it gets rebooted mid run I ge the error "RPC_E_DISCONNECTED"This then occurs everytime the program is run.Full error file below.I'd like to code for this error of course but even a simple fix to stop it happen once the PC has been rebooted to allow it to run again would do. I can give more details but I'm not sure where to start.Target system is windows XP SP3 with office 2007
[Code]...
I made my program and now I just need to add in the serial and trial part of the application. I know the application must connect to the host and go to a txtfile. How would i do the trial and serial. Also If the serial is already activated I want the application to reject that Serial and Count how many times they entered in a wrong serial.
View 2 RepliesI have a stand alone VB.Net 2005 application that uses a serial port that generally stays open while the application runs on a Windows XP system. In trying to bullet-proof the UI, I ran into a problem when the USB to Serial Converter normally used to provide the serial port is disconnected while the serial port is open. In trying to handle the resulting error when accessing the port, I find I cannot close the port.
When trying to do so, the error message says something like "unable to close the port. You may not have sufficient permissions." Reconnecting the USB/Serial Converter does not reactivate the port.
[Code]...
With this code i check the serial serialnumber of a usb stick.
[code]...
It is not perfect because the programma crash when there is no usb in de PC.But how do i search fot the sctick if it has a name , for example PPH ? And not G: , because it is everytime a different station.
Are Interfaces used often? Need opinions.
View 4 RepliesI have the following problem with MEF: Interface definition to be used by host:
Public Interface IExecuteDoSomething
Inherits IAddinSettings
Event DataReceived As EventHandler(Of DataReceivedEventArgs)
Function DoSomething() As Boolean
End Interface
[Code]...
Everything seems to work fine until the Button2_Click routine is executed, then an InvalidCastException is thrown with the info:Unable to cast object of type 'System.Collections.Generic.List1[SharedLibrary.IExecuteDoSomething]' to type 'System.Collections.Generic.List1[SharedLibrary.IAddinSettings]'.
How can i solve this problem, because the imported object implements both of the interfaces?
In this discussion let us discuss every usage of interfaces in .NET. Any real time examples and difficulties in using interfaces can also be discussed here.
View 6 RepliesIm building a game with VB.NET I designed the core of the game in form1 window But now I need menus. How can I implement this without having 5 or so windows that I show() and hide() ? Doing that slows it down a lot and uses lots of memory. I tried tabs, but I don't want the tabs to appear, just switch. Whats the best way to implement multiple interfaces?
View 1 RepliesHas someone a hint what I'm doing wrong in VB.Net?
Module Module1
Interface ISearch(Of T As ISearchResult)
Function ids() As List(Of T)
End Interface
[CODE]...
The third cast isn't working. Why? did I miss a oop lesson?
What I would like to do is make an abstract class that will hold objects in a dictionary and manage the adding/deleting/key changes of those items in the dictionary. My problem is that in order to make the class as generic as possible I declared the dictionary as dictionary(of long, of SomeInterface).The problem is when I try to pass a strongly typed dictionary in the constructor using dictionary( of long, ClassThatImplementsSomeInterface) I get a compiler error because it cannot convert to that type.
The reason I want to pass the dictionary in the abstract class's constructor is so that I can use the strongly typed dictionary in the subclass and have the abstract class manage the keys when it needs to. So how can I do something like this? Also- If there is a much better way to manage keys than what I am doing feel free to let me know, but I am much more interested in how to make this work since I have encountered this type of problem a few times before.
Here's the abstract class:
Public MustInherit Class HasChildrenKeys
Protected m_childItems As Dictionary(Of Long, IHasKey)
[code].....
I have a solution with multiple projects, some of the projects are written in VB, some in C#. I am wondering if there's a way to use interfaces and/or enums written in VB in C# classes? My C# code below doesn't compile, however I am able to see the interface in intellisense.
[Code]...
P.S It's a console/service application, not ASP.Net (where I know it's doable).UPD: Sorry guys, was missing a reference to the project with the interface. It's fixed now. I think the thing that in VB projects references are done slightly different than in C# confused me.
Say I have a interface called IProperties and I have a collection called colMyProperties that is a collection of IProperties. Then I have an object called clsProperty that implements the IProperty interface. Now, in my code where I add objects to the colMyProperties collection I add a bunch of clsProperty objects. so far so good.
Now when I try to access an object in the collection I can only access properties and methods of the IProperties interface, not the clsProperty object. What am I doing wrong? Do I need to cast the object?
I have a project that has several different interfaces (a website, a local application, and some webservices), that all use the same class library. The library is an API to a database. Some settings, like log level, database connection etc, i want to store in a single place, and I want them editable. What is the best way to accomplish this? I am concerned both about ease of editing, and ease of access for the dll, as there will be a lot of calls to it and a lot of lookups for the values. I have considered using app.config, a standalone XML file, and writing values to the registry, but I cannot find any good comparisons.
View 2 RepliesI have three classes which implement an Interface iComparesWith, and I wish there to be a single function such that each iComparesWith object of any of the three implementing classes should be able to compare itself with any other iComparesWith object, again, of any of the three implementing classes, and know if the two objects are equal. How can I code this so that the comparison code is only written once? Is it the case that I will have to create a top-level MustInherit class which implements the equality comparison, and have MustOverride methods for all of the methods of iComparesWith?
View 1 RepliesI am working on creating a customized UI composite control. This control would be a container to several other custom controls.As a first step, i am creating the container UI using a singleton pattern. This is because at any point in time only one isntance of this container is allowed to be created. This is fine.Now i want to practice interface based desgin. So i introduced a sinple interface calleD IdesignSurface which has two properties. I would like my singleton class to implement this interface,so i tried something like this and got an error saying "end of line
NotInheritable
Class DesignSurface
implements IDesignSurface
[code]......
I am a VB programmer of some 13 years. I started briefly with VB5 back in the mid-to-late 1990s, but then quickly moved to VB6 which I did for several years on PCs and HPCs (CE 1.x devices).I have done .NET 2002, 2003, 2005, and 2008 each for stints, intermingled with VB6 coding, at various jobs. But, I never got formally trained on VB.NET. In fact, I taught myself VB5/6 too. I have a degree in Computer Science and Mathematics, but the university CS program only had Unix systems. I basically learned everything I know on the fly from various Microsoft Press and other company's books (and the MS website/MSDN CDs too) while doing projects.I was wondering what everyone would suggest to really learn the .NET workings and why they are setup like that for Windows client/server applications. It doesn't have to be technical and brain-numbing.I have recently run into things dealing with MSFlexGrid vs DataGridView and how they link/work with database sources that confounds me. And, I am assuming there's just something I don't know about how/why VB.NET works the way it does...and I want to learn it to become a better developer.I want kind of that fun book that's easy to read, is thorough in that it teaches you a wide range of how to use/implement .NET controls/interfaces, and will fill in the gaps in my knowledge and experience.
View 1 RepliesWhen I pass an an object 'MyObject' which implements 'IMyInterface' to a method parameter declared as IMyInterface, I understand that this method parameter 'sees MyObject through the eyes of its interface'.
View 2 RepliesCan we call firewall an interface?
View 1 RepliesI have an interface called IBaselineControl. Now I'm trying to write a procedure which requires, as an argument, a Control which implements the IBaselineControl interface. However, I don't know the syntax for this. VB.Net allows us to require multiple interface implementations along with class inheritance when writing constraints for generic types. The syntax used there suggests that something like this might work:Public Sub Test(X As {Control, IBaselineControl})Unfortunately, that syntax doesn't work and I'm unable to find any syntax which does.
View 6 RepliesIs is possible to implement a type specifier with 2 interfaces in .net? Something like:
Public Sub New(obj as ICollection and INotifyCollectionChanged)
''Initialize Code
End Sub
I have a Delphi written DLL that exposes some interfaces to a vb.net application.
The interfaces inherit from IUnknown (but this could be changed if required), simplified example:
IWindow = interface(IUnknown)
['{E9A11D0B-8A05-4CBA-83FA-C5CC6818DF6E}']
function GetCaption(var Caption: PChar): HRESULT; stdcall;
end;
[Code]....
Now I want to transfer a collection of IWindow to vb.net, and in the vb.net application I want to be able to loop through it with a for in loop.
I read that it's possible using IEnumerable/IEnumerator but I don't quite understand how to implement them. Are there any good tutorials about this, specifically showing the declarations on both side? Example code would be great.
Please note that I prefer not create a com dll that should be registered and imported. Currently I export a function that enabled me to obtain an interface.
how to do something that seems that it should be simple.
I tried it on a larger project I'm working on and got an error, so I reduced it to the simplest possible that I could find:
Public Interface IF1
Event WakeUp(ByVal TheObject As Object)
End Interface
[Code]....
I just started playing around with interfaces recently and I have a couple things I want to ask. First off I always understood that an Interface cannot contain code, you are merely creating almost a "template" of methods, property's etc...Lets say I have this:
Public Class MyTest
Implements IMyTest
Public Sub iDispose() Implements IMyTest.iDispose
[code].....
I have the following code compiles without issue. Of course, I get an invalid cast xception when executing the Dim C As IDoThingsC = GetThing_C(). Am I missing something?Would you ever want to return an object that does not meet the interface requirement for a function return value?
Public Class ClassA
Public Sub DoThings_A()
Debug.Print("Doing A things...")
[code].....
is there any reason why we couldn't add/extend an interface to an already existing class?
i believe this would be v useful. it would be like drawing links from my class to already existing classes, and drawing links from already existing classes to already existing classes
I am looking for a way to add an interface implementation to a class at runtime.
Here is a sample code, which I will discuss below.
Public Interface IAction
Sub DoThis(a As Integer)
End Interface
[Code]....
This is related to WCF, where one needs to provide to CreateHost a single class, which implements all interfaces required for the end points. In this scenario, ActionDispatcher is such a class, and IAction is one of the many interfaces to be implemented.
My vision is to avoid implementing IAction in ActionDispatcher manually, but have some sort of registration mechanism, where I can say, that ActionDispatcher must implement interfaces IAction, IDoing, INoAction, etc - and have the dispatching methods generated for me.
MSDN says, that any class is compatible with any interface, so I don't need to declare "Implements" in the ActionDispatcher. But I still need to implement the interface and connect the implementing method to the interface definition, so WCF can find it when needed.
The closest thing I found is probably the Automatic Interface Implementer, but it (1) creates a new type, (2) adds dummy methods.
I has also tried to understand CodeCompileUnit class, but so far couldn't see the relation to what I need.
I am developing a web app but is not satisfied with is architecture that I am following. The architecture is plain old conventional 3 tier architecture. What i want is follow some design pattern or architecture that will be help me in decoupling my code.I have idea about MVC and MVP architectures for Web App but i need different from that. I want to use OOPS concepts using abstract classes and interfaces, polymorphism etc in my app but not MVC and MVP. I dont know why?
View 2 Replies