Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

[RESOLVED] So Many Questions

$
0
0
BackGround:

I've been experimenting with MEF and custom attributes. What I came up with to try and do is to come up with a simple application that loads up DLL's that contains forms.

The idea with this sample app is that the main project would be a windows form with only one MDI parent form. This project would load DLLs dynamically via MEF, with each DLL containing forms of their own.

Each DLL would each have a class named Menu with a custom attribute. That attribute will be used in the main project to create the menu (text, icon).

I'm already successfull with the DLL loadings my problem is with retrieving the attributes.

This code says that mnuEntity is not defined, even thoug it is defined in the loop.
Code:

        _Menus = _suiteObjects.Plugins

        For Each mnuEntity As IMenu In _Menus
            Dim mnuMetaData As MenuMetaDataAttribute = CType(Attribute.GetCustomAttribute(GetType(mnuEntity),
                                                                                          GetType(MenuMetaDataAttribute)),
                                                                                          MenuMetaDataAttribute)
        Next

Another question is why will I use attributes or what are the conditions in using the attributes. Thanks for those who will reply.

Am I doing this the right way or is there another way of doing this?

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>