Click here to Skip to main content
15,920,438 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to send text strings to Excel Worksheet? Pin
Rashar11-May-06 10:40
Rashar11-May-06 10:40 
QuestionNeed Help Accessing Functions in a DLL Pin
rjlohman11-May-06 10:24
rjlohman11-May-06 10:24 
AnswerRe: Need Help Accessing Functions in a DLL Pin
Dave Kreskowiak11-May-06 15:33
mveDave Kreskowiak11-May-06 15:33 
GeneralRe: Need Help Accessing Functions in a DLL Pin
rjlohman12-May-06 5:42
rjlohman12-May-06 5:42 
AnswerRe: Need Help Accessing Functions in a DLL Pin
arcticbrew12-May-06 9:37
arcticbrew12-May-06 9:37 
GeneralRe: Need Help Accessing Functions in a DLL Pin
rjlohman18-May-06 11:42
rjlohman18-May-06 11:42 
GeneralRe: Need Help Accessing Functions in a DLL Pin
arcticbrew18-May-06 12:45
arcticbrew18-May-06 12:45 
GeneralRe: Need Help Accessing Functions in a DLL Pin
rjlohman23-May-06 4:57
rjlohman23-May-06 4:57 
My Solution to This Problem (with help from arcticbrew)

Main Application (Form1) below is the executable app, written in VB 2005 Exp. It calls routines stored in external DLLs. The DLLs are also written in VB 2005 Express, using the Class Library template. The idea is that if a library needs modification, we should not have to recompile & redistribute the main application. Likewise, if the main application requires modification, we should not need to recompile/redistribute the DLLs that control data file interaction.

MAIN APPLICATION
----------------

Public Class Form1 'The main form in the .EXE application
    ...
    Public obj As New iolibrary.LocalIO
    Declare Auto Function GetDataFromFile Lib "iolibrary.dll" (ByVal filename As String) As Array
    Declare Auto Function WriteDataToFile Lib "iolibrary.dll" (ByVal arraydata As Array, ByVal filename As String) As Integer

    [other functions/subs/events as required...]

    Private Sub cmdGetData_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdGetData.Click
        'This sub makes a call to a function stored in a DLL (GetDataFromFile()) that
        'opens a predefined file (sFileName), gets data from it, stores that data in an
        'array, then returns the array for further processing.
        [data processing...]
        arInData = obj.GetDataFromFile(sInFileName)
        [data processing...]
    End Sub

    Private Sub cmdVendorToLocal_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdVendorToLocal.Click
        'This function takes data stored in an array (arOutData), and passes it, along
        'with a predefined file name (sOutFileName) into a function stored in a DLL
        'which writes the data out to that file. It then returns the number of rows
        'written.
        [data processing...]
        iRecsWritten = obj.WriteDataToFile(arOutData, sOutFileName)
        [data processing...]
    End Sub
End Class


DLL FILE
--------

Public Class LocalIO
    Public Function GetDataFromFile(ByVal sFileName As String)
        [data processing...]
        Return arInData
    End Function

    Public Function WriteDataToFile(ByRef arData As Array, ByRef sOutFileName As String)
        [data processing...]
        Return iNumRecsWritten
    End Function
End Class


Thanks all for your help.

Richard::Lohman()
QuestionParent/Child Forms Pin
jaded_angel11-May-06 9:28
jaded_angel11-May-06 9:28 
AnswerRe: Parent/Child Forms Pin
Dave Kreskowiak11-May-06 15:26
mveDave Kreskowiak11-May-06 15:26 
QuestionSSL FTP Pin
eagertolearn11-May-06 9:14
eagertolearn11-May-06 9:14 
QuestionPrinting on preprinted forms from different printers. Pin
nighttimeinar11-May-06 8:44
nighttimeinar11-May-06 8:44 
AnswerRe: Printing on preprinted forms from different printers. Pin
Duncan Edwards Jones12-May-06 8:23
professionalDuncan Edwards Jones12-May-06 8:23 
QuestionDecimal Places in a Double Pin
crtwrght_mrk11-May-06 7:50
crtwrght_mrk11-May-06 7:50 
AnswerRe: Decimal Places in a Double Pin
jwakeman11-May-06 8:55
jwakeman11-May-06 8:55 
GeneralRe: Decimal Places in a Double Pin
crtwrght_mrk11-May-06 9:25
crtwrght_mrk11-May-06 9:25 
QuestionOpen/Close Forms VB.Net Pin
Duane L.11-May-06 6:26
Duane L.11-May-06 6:26 
AnswerRe: Open/Close Forms VB.Net Pin
Jared Parsons11-May-06 10:28
Jared Parsons11-May-06 10:28 
GeneralRe: Open/Close Forms VB.Net Pin
Duane L.11-May-06 10:32
Duane L.11-May-06 10:32 
GeneralRe: Open/Close Forms VB.Net Pin
jwakeman11-May-06 10:43
jwakeman11-May-06 10:43 
GeneralRe: Open/Close Forms VB.Net Pin
Duane L.11-May-06 10:45
Duane L.11-May-06 10:45 
GeneralRe: Open/Close Forms VB.Net Pin
jwakeman11-May-06 11:42
jwakeman11-May-06 11:42 
GeneralRe: Open/Close Forms VB.Net Pin
Jared Parsons11-May-06 14:18
Jared Parsons11-May-06 14:18 
GeneralRe: Open/Close Forms VB.Net Pin
jwakeman12-May-06 3:02
jwakeman12-May-06 3:02 
GeneralRe: Open/Close Forms VB.Net Pin
Duane L.12-May-06 9:34
Duane L.12-May-06 9:34 

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.