.net - Createinstance() - Put Together A Plugins System With .NET

Apr 12, 2009

I'm trying to put together a plugins system with .NET, and I'm not sure if I'm doing it correctly. The basis of the system is that a specific directory ({apppath}/Plugins/) will have a bunch of precompiled DLLs, and I want to look through each one with reflection, and for every class available, if it inherits a specific base class (this is defined in yet another DLL, but I'll go into that later), then create an instance of it and call a specific function in said instance.

Public Sub ScanPluginsInDirectory(ByVal Directory As String)

Dim Plugins As New IO.DirectoryInfo(Directory)
Dim Files As IO.FileInfo() = Plugins.GetFiles("*.dll")

[CODE]................

The specific problem I have is, I'm not sure this is the right way to do this. Would the method I'm trying to do work, if it can be assumed that A.Plugin() actually exists and any structures and classes referenced here are bug-free?

View 2 Replies


ADVERTISEMENT

C# :: Checking Beforehand If `System.Activator.CreateInstance(Of T)` Will Fail?

May 24, 2011

I have a type (Human) and I want to know if I could do System.Activator.CreateInstance(Of Human)(). So basically I want to check if Human has a public parameterless constructor / or a public constructor with optional parameters that make it possible to call New Human without giving any arguments.Is it possible to check beforehand if ystem.Activator.CreateInstance(Of T) will fail? (I mean other than wrapping the statement System.Activator.CreateInstance(Of Human)() in a Try Catch of course..)I've tried this but it doesn't work:

Option Strict On : Option Explicit On
Module Test
Public Class Human

[code].....

View 4 Replies

Create A Plugin System Where Plugins Can Be Dynamically Loaded?

Dec 21, 2008

I am trying to create a plugin system where plugins can be dynamicly loaded (we don't know how many there are, what their classes are called, ...)This is sample code for a plugin:

Code:
Public Interface IPlugin
Sub bla()
Function bla3() As String
End Interface

[code]....

This code SHOULD msgbox("yay") when it finds a type that implements my IPlugin interface. Yet it never finds one. I can't find what I did wrong. It gets to the debug.print("2"), but never gets past the "If GetType(IPlugin).IsAssignableFrom(t) Then".

View 4 Replies

How To Make Activator.CreateInstance Threaded

Nov 5, 2011

I have some code that runs within a multithreaded class.Basically i create many threads which contain instance of this class.Within this class i create an object to either a vb6 or .net dll using reflection, then i call a method within that object. The object that gets called can be different every time.But for some reason even through i have multiple threads going when i get to the Activator.CreateInstance it is no longer multithreaded. I want to catch the error returned and put it in a log.

If UCase(pRow("TypeVB6").ToString()) = "TRUE" Then
classType = Type.GetTypeFromProgID(ClasstoInstantiate, True)
Else

[code]....

View 1 Replies

Redo Method Using Activator.CreateInstance?

Jun 7, 2012

how might I redo this method with Activator.CreateInstance

Public Overridable Function setCreditType() As CreditType
Select Case creditTypeId
Case Is = 0
Return New NewCredit(Me)
Case Is = 1

[Code]...

View 1 Replies

Create And Instance Of A Dictionary (Of K,V) With Activator.CreateInstance?

Apr 8, 2011

I'm trying to create a new instance of a Dictionary(Of String, ??) based on a ItemType variable I have. How do I construct the DictType so that I can use Activator to create an Instance of the type I'm after?

Dim ItemType As Type ' Data type of dictionary value
Dim DictType As Type = ???? ' Dictionary(of String, ItemType)
Dim NewDict = Activator.CreateInstance(DictType)

View 2 Replies

Make Plugins For The Program?

May 20, 2011

expand my program by allowing people to make plugins for the program. I thought of a way to do this: They can make a form/plugin on a form in VB then they can save it and upload the Form1.VB file and when you put that in a folder made by my program in "My Documents" my program will run that form like its, its own.

View 3 Replies

Plugins And Extensions For A Vb Application?

Mar 9, 2010

Firstly, I understand that this might sound more or less abstract, but this is because I have no previous experience in such applications. I completed an application using Visual Basic and is running and tested. What I want to do is
to make this application expendable i.e I could write other pieces of code and I would just plug it in to the application "somehow" and it would be added as a functionality.

View 1 Replies

Eclipse IDE, C# And Plugins That Supports .Net Framework4.0?

Sep 4, 2011

I want to use C# and VB.Net in Eclipse 3.7 Indigo.VB.netI could not find the plugin about VB.net in Eclipse.So I want to know is there a plugin for Eclipse that allows you to write C# or VB.net code using the .Net Framework 4.0 or 3.5?

View 1 Replies

Editing Settings For Individual Plugins?

Jun 6, 2012

I have a vb.net project that loads "plugin" dlls at runtime to crunch some data in slightly different ways and return the results. To do that, all the plugins implement the same interface, so the GUI couldn't care less how the plugin arrives at its final dataset, just so long as all the plugins deliver it back to the GUI in the same way.

I'd like to set up per-plugin options in addition to the main program options. I have an options form that accepts an object of type System.Configuration.ApplicationSettingsBase and displays the contents in a PropertyGrid control, so it'll show any My.Settings object the same way. Question is, how do I pull the My.Settings object out from a plugin that's loaded at run-time?

View 1 Replies

Can't Make A Seekbar Control Using A Windowmediaplayer And Vlc Plugins?

Oct 10, 2011

I cant make a seekbar control using a windowmediaplayer and vlc plugins

View 1 Replies

Development Techniques - Make A Program That Can Be Used With Plugins?

Aug 19, 2010

While I've mainly been developing small applications for personal use, I stumbled upon making a touchscreen application for a close friend. While he is not very good at programming, he is pretty well at drawing/etc... So, I thought about expanding my horizons some.I already have code that loads images from a folder, and made that folder changeable via the program, so in effect, probably a horribly coded way of skinning some parts of the program (the buttons). But then I though about it some more and really wanted to learn a better way to make my programs 'expandable'.I have begun searching about how to make a program that can be used with plugins, how to make plugins, and so on... I am researching about dynamically changing controls and other things, so that when resolutions change, I don't have to code each individual buttons new size/location, and, most importantly, a way to implement patching/app upgrades...

View 2 Replies

Stable Plugins Architecture Using An Appdomain Per Plugin?

Jun 22, 2010

how to create a stable plugin architecture. Stable because I plan on opening up plugin creation to the public but I dont want a sloppy coded plugin to take down my whole application.

So I thought of using an AppDomain per plugin and I did a little seaching. But it seems that even using a temp AppDomain to load plugins and then unloading it once all assemblies have been inspected raises complexity allot and I was planing on using an AppDomain per plugin.

I feel the gained stability (if there is any at all) may be raising the complexity so much the app will never be done..

Is there another way to both create a stable application and at the same time making it extensible?

I cases where the host calls a defined function via say IPluginInterface I guess I can pack a whole lot of try catch blocks around that call but what if a plugin insisted of a timed routine that would run continously without being invoked from the host other that a starting call to StartPluginService or something like that?

If I include a plugin like that in the default AppDomain and it blows up I sure will blow my own foot off right?

View 3 Replies

Plugins - Org Chart Control/Plug-In For WPF Multitouch Application?

Nov 5, 2010

I have been working on a UI app (written in VB.NET and using WPF) which creates charts using the Microsoft Chart Control for Windows Forms. The application retrieves data periodically from a remote database, parses and formats the data to create series, and then creates a chart based off the series which is then hosted in a WindowsFormsHost control. So far this process has been working well.

View 1 Replies

Add Custom Plugins For The App For Additional Features, Without People Having To Download A Whole New Update Each Time?

Nov 28, 2009

I am trying to figure out an easy way to add custom plugins for the app for additional features, without people having to download a whole new update each time.i guess the way i'd want it to work is,the program will auto detect the plugin file. Then, add's a specific value to either a button array, or add's a picture, etc.Once that button is clicked, it will open a new form designed the way i want it. from within the plugin itself.So its a module.What would be the easiest way to do this?

View 2 Replies

Cannot Import System.Windows.Media.Imaging And System.Windows.Forms Or System.Reflect?

Mar 16, 2009

With the following imported namespaces in my project :

Imports System.Windows.Forms
Imports System.Reflection
.. I cannot add..

[code].....

View 6 Replies

IDE :: DataGridView1_CellLeave(sender, New System.EventArgs), Unable To Cast Object Of Type 'System.EventArgs' To Type 'System.Windows.Forms.DataGridViewCellEventArgs'.

Jun 27, 2011

VB 2008, DataGridView,DataGridView1_CellLeave(sender, New System.EventArgs)

"Unable to cast object of type 'System.EventArgs' to type 'System.Windows.Forms.DataGridViewCellEventArgs'."

What is the Correct String for "New System.EventsArgs"

Anybody there is to help me out.

View 1 Replies

Error - LINQ To Entities Does Not Recognize The Method 'System.Object IIf(Boolean, System.Object, System.Object)'

Jul 29, 2011

I am getting following error whenever I want to use IIf function inside entity framework query.

LINQ to Entities does not recognize the method 'System.Object IIf(Boolean, System.Object, System.Object)' method, and this method cannot be translated into a store expression.

View 1 Replies

Method 'System.Object CompareObjectEqual(System.Object, System.Object, Boolean)' Has No Supported Translation To SQL.?

Apr 16, 2010

What do I need to convert?

Dim CEESearchByAppNo = From CEEsearch In dbCEE.tblScanneds _
Where CEEsearch.AppNo = iAppNo

[code].....

View 5 Replies

Unable To Cast Object Of Type 'System.String' To Type 'System.Predicate`1[System.String]

May 13, 2009

I am getting the following erro message: "Unable to cast object of type 'System.String' to type 'System.Predicate`1[System.String]'." on the line of code: If Not StrgFrag.Exists(wrd) Then I was expecting a True/False response and assumed it would work given that wrd is a String variables and StrgFrag in a List(of String). Do I need to reference the wrd variable differently? Dim StrgFrag As New List(Of String)

[Code]....

View 2 Replies

Error: A First Chance Exception Of Type 'System.InvalidOperationException' Occurred In System.Data.dll

May 5, 2011

I am using VS 2008, Office 2007, and Win7 Home Premium on my system.I have a simple application which should be a breeze to build. All I am attempting to do is pull data from an Access database with four small tables into a data grid on a windows project. Should be simple, set up the data connection, choose a datagrid from the table in the data source view, drag it onto the page and done, right?I can't get it to work. It will all work fine until I attempt to run or debug the project. The data will not show up. The data grid does, but I get this error: A first chance exception of type 'System.InvalidOperationException' occurred in System.Data.dll

As I said, the project seems to build fine, but it will not pull the data. After the initial build I get the message that Windows will show this page in Compatibility View. Is it something with Win7 Home Premium, or a setting somewhere?

View 4 Replies

System.io.fileinfo Cannot See A File In System Folder On Windows Server 2008 64bit

Jan 28, 2010

I have a utility that is a simple exe that is not installed compiled with VS2005 and works well. But when I upgraded to VS2008 the utility can no longer locate files in the active system folder. I have UAC turned off and am logged in as the Administrator and it still can not locate a file that I can see in Windows Explorer. The file I am looking for is PakMgr.exe.

View 1 Replies

System.TypeInitializationException: The Type Initializer For 'System.ServiceModel.ClientBase' 1' Threw An Exception

Dec 22, 2009

I'm using express 2008 build the windows app. and in the app, it calls a webservice which was built by VS2003.It works fine on most PCs. however, there is one PC, it always shows this error:

System.TypeInitializationException: The type initializer for 'System.ServiceModel.ClientBase' 1' threw an exception
....
System.configuration.ConfigurationErrorException: Configuration system failed to initialize ---> System.Configuration.ConfigurationErrorsException:
Unrecognized configuration section system.serviceModel
.....

however, the configuration file was generated by express 2008, and it seems there is no error.

View 2 Replies

Unable To Cast Object Of Type 'System.EventArgs' To 'System.ComponentModel.CancelEventArgs'

Jul 11, 2012

I have a text-boxes that use both the validating event as well as the lostfocus event.I have pinpointed the exception in the post title to the validating events.[code]Maybe I am unaware that CancelEventArgs are not suppose to be used in the validating event? [code]

View 4 Replies

VS 2008 : Error - Cannot Perform 'Like' Operation On System.Int32 And System.String"

Nov 2, 2009

I'm trying to use DataView.Rowfilter and I'm getting an exception which says "Cannot perform 'Like' operation on System.Int32 and System.String".

Here's the code...

Dim str2 As Double = CDbl(searchSTR)
Me.shipperDV.RowFilter = fieldName & " LIKE '*" & str2 & "*'"

View 7 Replies

A First Chance Exception Of Type 'System.UnauthorizedAccessException' Occurred In System.DirectoryServices.dll

Dec 16, 2010

I would like to create a local user on a windows 7 PC, but gets the following error when commitchanges runs. I am administrator on the PC:

A first chance exception of type 'System.UnauthorizedAccessException' occurred in System.DirectoryServices.dll

Here is my code:

CODE:

I am using Visual Basic 2010 ultimate in Visual Studio 2010.

View 4 Replies

C# - What Could Cause System.Timers.Timer.set_Enabled Property To Throw A System.NullReferenceException

Apr 4, 2012

Here is the stack trace:

2012-03-16 19:15:09Z E System.NullReferenceException: Object reference not set to an instance of an object.
at System.Timers.Timer.set_Enabled(Boolean value)
at System.Timers.Timer.Stop()

Here's the code:

Timer declared as private member variable.
Private _myTimer As System.Timers.Timer
Initialize timer method.

[code]....

The timer has to have a value or else the Timer.Stop() call would be throwing the exception. This is a sporadic error and I'm just trying to see if anyone has experienced this before or if anyone has any ideas of what could be causing it. It is occuring in a WinForms application in the event handler for the Elapsed event of the Timer, but it is only occuring sporadically on the users computer. I haven't been able to reproduce the error myself.

View 2 Replies

DB/Reporting :: Error: Cannot Perform '=' Operation On System.Int32 And System.String

Mar 6, 2010

I wrote the code below which calculates the length of a line on the form and save record. An error occurs when the programme tries to save the record. It gives me "Cannot perform '=' operation on System.Int32 and System.String" error. I checked the data type of "ID"(int), "Microscope"(Varchar), "Magnification"(int) and "Calibration"(Decimal), and they are fine so far as I know.

Code:
Private Sub btnEnd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnd.Click
'Check if the length textbox is not empty

[Code].....

View 4 Replies

Error : An Unhandled Exception Of Type 'System.StackOverflowException' Occurred In System.dll

Mar 21, 2011

get out from the below loop

Shared Function GetIPAddress() As String
Dim sam As System.Net.IPAddress
Dim sam1 As String

[code]....

View 4 Replies

Exception Of Type 'System.ComponentModel.Win32Exception' Occurred In System.Drawing.dll

Oct 14, 2011

I have a program that creates a Treeview from information procured through an ODBC query and dumped into a dataset. I have three such queries set up via radial buttons as well as a refresh button that triggers whatever radial button is active at the time it's clicked. The purpose of this program is to allow drag-and-drop of selected nodes, ending with a post to the database that officially makes that change of assignment to the new node.

[Code]...

View 5 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved