Rolando Ramirez Weblog @ DotNetJunkies

<November 2008>
SuMoTuWeThFrSa
2627282930311
2345678
9101112131415
16171819202122
23242526272829
30123456


Navigation

Subscriptions

Post Categories



Passing an array of strings from VB6 to .net (C#)

I'm developing a .net library that contains many functions that will be used from legacy VB6 apps, in one function I need to pass an array of strings from VB6 to the .net class and since I haven't done something like that before and search the .net docs without luck, then after a lot of googling I found how to pass a string array from .net to VB6 but not the other way, after more googling I found a post in a newsgroup that suggests to use an object type parameter to receive the VB6 array and it did the trick but I would like to know if there's a better way to acomplish this...

C#

public void CreateZipFile(string zipFile,
                          object filesToZip) {
  
  //
  string[] listFilesToZip = (string[]) filesToZip;
  ...

VB6

  ...
  Dim strFiles(2) As String
 
  Set objZipper = New MyNamespace.FunctionsToUseFromCom
 
  strFiles(0) = "C:\tmksrvl.exe"
  strFiles(1) = "C:\setup1.log"
  strFiles(2) = "C:\sqlresld.dll"
  Call objZipper.CreateZipFile("C:\temp\ZipFromNet12.zip", strFiles)
  ...

posted on Thursday, October 14, 2004 10:15 AM by rramirezg





Powered by Dot Net Junkies, by Telligent Systems