Click here to Skip to main content
15,909,199 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionAudio Spectrum Vu-Meter Pin
HdaiR4-Mar-14 5:40
HdaiR4-Mar-14 5:40 
AnswerRe: Audio Spectrum Vu-Meter Pin
Richard Andrew x644-Mar-14 11:14
professionalRichard Andrew x644-Mar-14 11:14 
GeneralRe: Audio Spectrum Vu-Meter Pin
HdaiR4-Mar-14 22:21
HdaiR4-Mar-14 22:21 
Questionnature Pin
Lakmali Perera3-Mar-14 17:49
Lakmali Perera3-Mar-14 17:49 
AnswerRe: nature Pin
Dave Kreskowiak3-Mar-14 18:10
mveDave Kreskowiak3-Mar-14 18:10 
QuestionRe: nature Pin
Eddy Vluggen4-Mar-14 1:34
professionalEddy Vluggen4-Mar-14 1:34 
AnswerRe: nature Pin
Bernhard Hiller4-Mar-14 2:23
Bernhard Hiller4-Mar-14 2:23 
QuestionVB6 to VB.Net COM Interface Help Pin
sashaw22-Mar-14 9:37
sashaw22-Mar-14 9:37 
Why do i get the error - "Function or interface marked as restricted, or the function uses an Automation type not supported in Visual Basic", when I try to pass a String array from vb6 to a class:Property string array in vb.net?

This is the vb6 code:

VB
Option Explicit

Private Sub btnTest_Click()
    Dim strTest(4) As String
    strTest(1) = "abc"
    strTest(2) = "def"
    strTest(3) = "ghi"
    strTest(4) = "jkl"
    
    On Error GoTo err1
        
    Dim clsTest As ComTest.clsValues
    Set clsTest = New ComTest.clsValues
    
    clsTest.SingleString = "this is my string"
    clsTest.stringArray = strTest   ' <<<ERROR IS HERE
    
    MsgBox "Single string = " & clsTest.SingleString, vbInformation, "Test"
    
    Dim x As Integer
    
    For x = 0 To UBound(clsTest.StringArray)
        MsgBox "Multi string 2 = " & clsTest.StringArray(x), vbInformation, "Test"
    Next x
    
    Exit Sub
    
: err1
    MsgBox "Error: " & Err.Number & vbCrLf & Err.Description, vbCritical, "btnTest_Click"
    On Error Resume Next
    
End Sub



This is the vb.net class

VB
Imports System.Runtime.InteropServices

<ComClass(clsValues.ClassId, clsValues.InterfaceId, clsValues.EventsId)> _
Public Class clsValues

#Region "COM GUIDs"
    ' These  GUIDs provide the COM identity for this class 
    ' and its COM interfaces. If you change them, existing 
    ' clients will no longer be able to access the class.
    Public Const ClassId As String = "095dc64d-141f-46f9-9af2-1c5e633b459b"
    Public Const InterfaceId As String = "86ec1f14-1ef4-446d-9172-b92cf260cd16"
    Public Const EventsId As String = "1605e412-8b11-4ee0-a34c-9ec04464737f"
#End Region

    ' A creatable COM class must have a Public Sub New() 
    ' with no parameters, otherwise, the class will not be 
    ' registered in the COM registry and cannot be created 
    ' via CreateObject.
    Public Sub New()
        MyBase.New()
    End Sub

    Private mSingleString As String
    Public Property SingleString() As String
        Get
            Return mSingleString
        End Get
        Set(ByVal value As String)
            mSingleString = value
        End Set
    End Property

    Private mStringArray() As String
    Public Property StringArray() As <MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> String()
        Get
            Return mStringArray
        End Get
        Set(<MarshalAs(UnmanagedType.SafeArray, safearraysubtype:=VarEnum.VT_BSTR)> ByVal value As String())
            mStringArray = value
        End Set
    End Property

End Class


The class has been compiled and the .tlb has been registered.

The class has been referenced in vb6.

Error on clsTest.StringArray(x) in vb6 when trying to run project

modified 3-Mar-14 10:14am.

QuestionRe: VB6 to VB.Net COM Interface Help Pin
Richard Deeming3-Mar-14 0:36
mveRichard Deeming3-Mar-14 0:36 
AnswerRe: VB6 to VB.Net COM Interface Help Pin
sashaw23-Mar-14 4:16
sashaw23-Mar-14 4:16 
AnswerRe: VB6 to VB.Net COM Interface Help Pin
Richard Deeming3-Mar-14 7:17
mveRichard Deeming3-Mar-14 7:17 
GeneralRe: VB6 to VB.Net COM Interface Help <<< SOLVED >>> Pin
sashaw23-Mar-14 11:01
sashaw23-Mar-14 11:01 
QuestionPlease help me,.? Pin
M.Aprianto2-Mar-14 5:42
M.Aprianto2-Mar-14 5:42 
AnswerRe: Please help me,.? Pin
Eddy Vluggen2-Mar-14 7:44
professionalEddy Vluggen2-Mar-14 7:44 
Questionhow to make session timeout to automatically logout? Pin
charles entsuah28-Feb-14 10:31
charles entsuah28-Feb-14 10:31 
AnswerRe: how to make session timeout to automatically logout? Pin
ZurdoDev28-Feb-14 10:58
professionalZurdoDev28-Feb-14 10:58 
Questionupload pdf , save pdf in to a table, and read it from a datagrid on double click Pin
waner michaud28-Feb-14 9:07
waner michaud28-Feb-14 9:07 
AnswerRe: upload pdf , save pdf in to a table, and read it from a datagrid on double click Pin
Eddy Vluggen2-Mar-14 7:52
professionalEddy Vluggen2-Mar-14 7:52 
QuestionThreading.Thread.Sleep(5000) causing my splash screen to not show values. Help appreciated. Pin
ChristGuard26-Feb-14 9:46
ChristGuard26-Feb-14 9:46 
AnswerRe: Threading.Thread.Sleep(5000) causing my splash screen to not show values. Help appreciated. Pin
Dave Kreskowiak26-Feb-14 11:17
mveDave Kreskowiak26-Feb-14 11:17 
GeneralRe: Threading.Thread.Sleep(5000) causing my splash screen to not show values. Help appreciated. Pin
ChristGuard26-Feb-14 12:00
ChristGuard26-Feb-14 12:00 
GeneralRe: Threading.Thread.Sleep(5000) causing my splash screen to not show values. Help appreciated. Pin
Dave Kreskowiak26-Feb-14 16:17
mveDave Kreskowiak26-Feb-14 16:17 
Questionreading html data using the vb script Pin
Member 1062036024-Feb-14 17:32
Member 1062036024-Feb-14 17:32 
AnswerRe: reading html data using the vb script Pin
Dave Kreskowiak24-Feb-14 17:38
mveDave Kreskowiak24-Feb-14 17:38 
GeneralRe: reading html data using the vb script Pin
Member 1062036024-Feb-14 17:40
Member 1062036024-Feb-14 17:40 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.