Advertisement

02.20.2008 at 12:24AM PST, ID: 23176901
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

9.3

create dll in dotNet and use it in VB6

Asked by bfanis in VB Objects, Miscellaneous Programming, ActiveX

Tags:

hi

i need to use a code written written dotNet  in vb6

i have created a classLibrary Project in dotNet  and i have built it , i got a dll file , a tlb file and an xml file

in vb6 , when i try to add the dll file as a reference i get this error message  : "unable to add reference to the specified file ..."

i added a reference to the tlb file and wrote a piece of code to call my function  "ConvertBMP" , i got a message at run time : "activex cannot create object..."

can anyone help me on that , is this the right way to do it or there is an other way ??

thanks in advance
========================================
dotNet
========================================
Imports System.IO.Path
Imports System.Drawing
Imports System.Drawing.Imaging
Public Class ClsConvertBMP
    Public Function ConvertBMP(ByVal BMPFullPath As String, _
                               ByVal NewNameImage As String, _
                               ByVal NewFormat As String) As Boolean
        Dim bAns As Boolean
        Dim sNewFile As String
        Dim imgFormat As ImageFormat = ImageFormat.Bmp
        Try
            'bitmap class in system.drawing.imaging
            Dim objBmp As New Bitmap(BMPFullPath)
            'below 2 functions in system.io.path
            sNewFile = GetDirectoryName(BMPFullPath)
            sNewFile += NewNameImage
            Select Case NewFormat
                Case "BMP"
                    imgFormat = ImageFormat.Bmp
                Case "GIF"
                    imgFormat = ImageFormat.Gif
                Case "JPG"
                    imgFormat = ImageFormat.Jpeg
                Case "TIF"
                    imgFormat = ImageFormat.Tiff
                Case "WMF"
                    imgFormat = ImageFormat.Wmf
            End Select
            sNewFile += "." & imgFormat.ToString
            objBmp.Save(sNewFile, imgFormat)
            bAns = True 'return TRUE on success
        Catch ex As Exception
            bAns = False 'return FALSE on echec
            'MsgBox("ConvertBMP : " & ex.Message)
        End Try
        Return bAns
    End Function
End Class
=========================================
VB
=========================================
Dim aa As New ClassLibrary1.ClsConvertBMP
Dim Ret As Boolean
Ret = aa.convertBMP("D:\test1.bmp", "Convert", "BMP")   <--- error here

End Sub
Start Free Trial
 
Loading Advertisement...
 
[+][-]02.20.2008 at 04:57AM PST, ID: 20937309

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: VB Objects, Miscellaneous Programming, ActiveX
Tags: DotNet, vb6
Sign Up Now!
Solution Provided By: Arthur_Wood
Participating Experts: 2
Solution Grade: A
 
 
[+][-]02.20.2008 at 06:00AM PST, ID: 20937765

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628