Start a new topic

External .vb files?

Is there any way to include external .vb files?

I am thinking about setting up IOM to use a webservice call (REST API) to do some data updating from our website.

I have a framework for building and processing the calls in PHP which I could probably port to VB but it would be nice to have it in a separate module that I would include somehow in the IOM API.

Ideas?


Wayne,

You could potentially create a class or module in the global tab, that way an external file isn't necessary. Also if you wanted you could compile this code into a DLL and place the dll in the plugins folder of each machine that would make use of it. This way you could use late binding to create objects from your DLL and interact with them.

Using an external DLL is probably best suited to prompting the user with a custom UI to handle processing.
Thanks Nic,

I had managed to get some custom UI working at some point with the IOM API but in this case I don't really need any user interaction, just pulling and updating data. I'll work on making class in the global.vb

Thanks
Wayne,



you mentioned that you got a custom UI working in the past. I tried to do this as well at some point but did not manage. Could you tell me how you did that? I see that Nic said to create a dll. I could try this. But what did you do? (Sorry for being off topic in this post.)
BTW: I created custom classes in both the global code and the profile code part. It is straight forward. I attached a class which is basically a text file writer which I use to create log file of imports and it is also handy in debugging. I don't seem to be able to attach files so I am including the code below:



[code] Public Class WL Private filePath As String Private fileStream As FileStream Private streamWriter As StreamWriter Private strPath As String Public Property Path() As string Get Return strPath End Get Set (ByVal Value As String) strPath = Value End set End Property 'Import Log Handler Subs '======================= Public Sub OpenFile() Dim strDefaultPath As String = profile.Import.ImportFileFolder & "\ExportLog_" & Format(now(),"yyyy.MM.dd_HHmmss") & ".txt" Try If Path = "" Then Path = strDefaultPath End if If System.io.File.Exists (Path) Then FileStream = New FileStream (Path, FileMode.Append, FileAccess.Write) Else FileStream = New FileStream (Path, FileMode.Create, FileAccess.Write) End If StreamWriter = New StreamWriter(fileStream) Catch ex As Exception msgbox("Error in Write log Open File sub: " & ex.Message) End Try End Sub Public Sub WriteLog (ByVal strComments As String) Try OpenFile() StreamWriter.WriteLine(strComments) CloseFile() Catch ex As Exception msgbox("Error in Write log WriteLog sub: " & ex.Message ) End try End Sub Public Sub CloseFile() StreamWriter.Close() fileStream.Close() End Sub End Class [/code]
(please disregard the "&" and replace it with a "&". Not sure how this got in there.)

Here is the post that got me started from Nic

http://www.omaticsoftware.com/Forums/tabid/108/aft/606/Default.aspx

It has been a while but basically I created the UI as an application in Visual Studio

Here is what I had in my IOM profile code (without the comments obviously)

    Public Overrides Sub AfterDictionaries(Cancel as ImportOM.API.iCancel)
        'The data row at this point has gone through dictionaries
        'Use the Fields object to access the data
        'Example: Import.Fields.GetByExcelName("D").Value = "New Value for D Column"
        'Dim sText1 As String = "Foo"
        'Dim sText2 As String = "Bar"
        'Dim o As Object
        'o = CreateObject("ClassLibrary1.TestClass")
        'o.HelloWorld(sText1, sText2)

    End Sub

Attached is my Visual Studio project for this.  My license ran out and I don't recall exactly what I had to do but I remember that I had some trouble until I was able to get the .dll registered correctly on the machine.

ClassLibrary1.zip

P.S. Attaching a file is very hard in this forum...  and the forms don't really work in Chrome.

This is great!  Thanks
Login or Signup to post a comment