Options

VB.NET Automation DLL

smorenosmoreno Member Posts: 4
Hello.

I have made an automation control with vb.net to pass the bmp files to jpg, but when we want create the instance in navision it gives the following error:
This message is for C/AL programmers:

Could not create an instance of the OLE control or Automation server identified by GUID={10F16FCF-4EF8-4E90-9C55-44B2D9035C7D}
1.1:{A0DC9EB3-37D6-3FB5-8E26-C0ACABDD2B84}:’bmp2jpg’.IManage.
Check that the OLE control or Automation server is correctly installed and registered.
I can use the variable in C/AL code but at the time of executing it gives an error. I have registered the DLL with regasm.exe and I can use without any problem from another application.
It is necessary to make something additional so that it works in navision?

I am sorry for my bad english.

Thanks in advance.

Comments

  • Options
    ara3nara3n Member Posts: 9,256
    hello smoreno
    Please take a look at this website http://blogs.msdn.com/skydtsgaard/default.aspx

    It has steps on how to create a .NET DLL and access it from Navision.
    Ahmed Rashed Amini
    Independent Consultant/Developer


    blog: https://dynamicsuser.net/nav/b/ara3n
  • Options
    IHateLinuxIHateLinux Member Posts: 223
    Hi,

    first of all, which Navision version do you use?

    And on the other hand, you have to create a COM interop assembly for your control. Navision can not (yet) access and run directly "pure" .NET assemblies.

    What do you want to do with that assembly? I can see that you try to convert a BMP to JPG, but from where do you get the BMP and where do you want to save the JPG (Database / File / ...)?

    HTH,

    Rainer
  • Options
    smorenosmoreno Member Posts: 4
    Hi,

    I'll try this in Nav 3.60, 3.70 and 4.0. Now i get the bmp file from file, but in the future i want to take it from BLOB field. I have set a true the property “Register for COM Interop” in the project.

    This is my vb code:
    Public Class Manage
        Inherits System.Windows.Forms.UserControl
    
        Implements IManage
        Dim bmp As Bitmap
        Dim JPGQuality As Integer = 90
    
        Private Function GetEncoderInfo(ByVal mimeType As String) As System.Drawing.Imaging.ImageCodecInfo
            Dim j As Integer
            Dim encoders As System.Drawing.Imaging.ImageCodecInfo()
            encoders = System.Drawing.Imaging.ImageCodecInfo.GetImageEncoders()
            For j = 0 To encoders.Length
                If encoders(j).MimeType = mimeType Then
                    Return encoders(j)
                End If
            Next j
            Return Nothing
        End Function
    
        Public Sub LoadBMPFile(ByVal FileName As String) Implements IManage.LoadBMPFile
            bmp = New Bitmap(FileName)
        End Sub
    
        Public Sub SetJPGQuality(ByVal Quality As Integer) Implements IManage.SetJPGQuality
            JPGQuality = Quality
        End Sub
    
        Public Sub SaveJPGFile(ByVal FileName As String) Implements IManage.SaveJPGFile
            Dim eps As System.Drawing.Imaging.EncoderParameters = New System.Drawing.Imaging.EncoderParameters(1)
            eps.Param(0) = New System.Drawing.Imaging.EncoderParameter(System.Drawing.Imaging.Encoder.Quality, JPGQuality)
            Dim ici As System.Drawing.Imaging.ImageCodecInfo = GetEncoderInfo("image/jpeg")
            If Not bmp Is Nothing Then
                bmp.Save(FileName, ici, eps)
            End If
        End Sub
    End Class
    
    Public Interface IManage
        Sub LoadBMPFile(ByVal FileName As String)
        Sub SetJPGQuality(ByVal Qualtity As Integer)
        Sub SaveJPGFile(ByVal FileName As String)
    End Interface
    

    I don't see Methods of the Manage class in Navision, but i see those of the IManage.

    Thanks.
Sign In or Register to comment.