Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / Interop / October 2005

Tip: Looking for answers? Try searching our database.

how to marsal vb string() to unmanged legacy application?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
learner - 01 Oct 2005 18:59 GMT
I have done searches on msdn, newsgroup, lists, so far I don't see any
example showing me how to get array of string to legacy application ( C and
vbscript)
My mange dot net is compiled in a COM class assembly.

Without custom code, I get
Microsoft VBScript runtime error: Type mismatch

I am trying find a way to  getting array across from managed code to
unmanaged.

Help is much appreciated.  Thanks for your time.
Richard T. Edwards - 03 Oct 2005 11:47 GMT
What's your code look like?

>I have done searches on msdn, newsgroup, lists, so far I don't see any
>example showing me how to get array of string to legacy application ( C and
[quoted text clipped - 8 lines]
>
> Help is much appreciated.  Thanks for your time.
learner - 04 Oct 2005 07:13 GMT
Thank you for replying:
here is the simplified part of the code
'-------------------------------------------------::::
Imports System
Imports System.Text.RegularExpressions
Imports Microsoft.VisualBasic
Imports Microsoft.Win32
Imports System.Text.Encoding

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

#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 = "0a487659-4f71-45f5-b4cd-223d897c40ba"
   Public Const InterfaceId As String =
"a0654bfb-dca9-4f3b-82ab-62e77e11d08a"
   Public Const EventsId As String = "194cb6e2-0e1f-46bb-9fac-0eb312219681"
#End Region

'  ... some constant declarationa nd soem class variables
   Dim Date_Patterns() As String
' ...

   Public Sub New()
       '050917 fixed patterns by adding ignorecase
       MyBase.New()
 '.... some initialztion code
 '   buildup up string values into Date_Patterns
End Sub

    Public Function getDate_Patterns() As String()  ' does not work: Type
Mismatched
       Return Date_Patterns
   End Function

   Public Function getDate_PatternsSz() As Integer   ' tested
       Return Date_Patterns.GetUpperBound(0)
   End Function

   Public Function getDate_PatternsElement(ByVal i As Integer) As String
' tested
       If i <= Date_Patterns.GetUpperBound(0) Then
           Return Date_Patterns(i)
       Else
           Return ""
       End If
   End Function

....

   Public Function atst(ByVal iCnt As Integer, ByRef iarr As Integer()) As
Integer() ' again call to this funciton results in "type mismatch or invalid
call"
       'Public Function atst(ByVal iCnt As Integer, ByRef astr As
Collection) As Integer
       ' Dim lstrA() As String = {"a", "b", "c", "d", "e"}
       Dim lstrA() As Integer = {1, 2, 3, 4, 5}
       iarr = lstrA.Clone()
       If iCnt > 5 Then
           iCnt = 5
           atst = lstrA.Clone()
       ElseIf iCnt > 0 And iCnt <> 5 Then
           ReDim Preserve lstrA(iCnt)
           atst = lstrA.Clone()
       Else
           iCnt = 0
       End If

   End Function

End Class\
' ------------------ End of code ------------

> What's your code look like?
>
[quoted text clipped - 10 lines]
>>
>> Help is much appreciated.  Thanks for your time.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.