Gaurav Taneja

Great dreams... never even get out of the box. It takes an uncommon amount of guts to put your dreams on the line, to hold them up and say, "How good or how bad am I?" That's where courage comes in.

  Home  |   Contact  |   Syndication    |   Login
  90 Posts | 0 Stories | 78 Comments | 7 Trackbacks

News




Google RankGoogle PR™ - Post your Page Rank with MyGooglePageRank.com



The content on this site represents my own personal opinions and thoughts at the time of posting, and does not reflect those of my employer's in any way.

Disclaimer:- All postings in this blog is provided "AS IS" with no warranties, and confers no rights.

Archives

Post Categories

Image Galleries

Atlas

Error

OutLook

SharePointService

Usefull Site Links

CREATING DLL DYNAMICALLY

you need to complie this code

Public Function CreateResourceAssembly() As Boolean
        Dim currentpageHashVal As Hashtable = New Hashtable()
        Dim intArrIndx As Integer
        Dim strTextVal As String
        Dim blnIsSuccess As Boolean
        Dim strAsmFileName As String = FetchTest.resources.dll
        Dim strPathAssmbly As String = strAppPath + FetchTest.resources.dll"
 
        Dim appdomain As AppDomain = Thread.GetDomain()
        Dim asmName As New AssemblyName()
        Dim strVersion As String = Nothing
        Dim strKey As String = Nothing
        Dim hashResPage As Hashtable = New Hashtable()
        Dim ItemEnumeratorPage As System.Collections.IDictionaryEnumerator
        Dim blnIdExist As Boolean = False
 
        asmName.Name = Wpms.resources.dl
 
        Dim resourceName As String = Wpms.resources"
        asmName.CodeBase = strPath
        Dim strDate As String
        strDate = Date.Now.ToString("dd/MM/yyyy").Replace("/", "")
        intBuild = CType(strDate, Integer)
        intRev = intRev + 1
        strVersion = "1.0.0" & "." & CType(intRev, String)
        asmName.Version = New Version(1, 0, 0, intRev)
        asmName.CultureInfo = New CultureInfo(strLang)
 
        Dim asmBuilder As AssemblyBuilder = appdomain.DefineDynamicAssembly(asmName, AssemblyBuilderAccess.RunAndSave, strPath)
        Dim modulebuilder As ModuleBuilder = asmBuilder.DefineDynamicModule(strAsmFileName, strAsmFileName)
        Dim resWriter As System.Resources.IResourceWriter
        Dim blnGenEngRes As Boolean = True
        resWriter = modulebuilder.DefineResource(resourceName, "MyDescription", ResourceAttributes.Public)
 
‘ writing in resource file below is a n example ….
   Dim ItemEnumerator As System.Collections.IDictionaryEnumerator
ItemEnumerator = resHastable.GetEnumerator()
   Do While ItemEnumerator.MoveNext
                    resWriter.AddResource(CType(ItemEnumerator.Key, String), CType(ItemEnumerator.Value, String))
                Loop
 
                asmBuilder.Save(strAsmFileName) ‘ SAVING ASSEMBLY
Return blnIsSuccess
 
End Function
  • Share This Post:
  • Share on Twitter
  • Share on Facebook
  • Share on Technorati
posted on Wednesday, December 10, 2008 11:32 PM