Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Overloading Functions

Posted on 2004-10-14
4
Medium Priority
?
249 Views
Last Modified: 2010-04-24
Hi

Is there any obvious flaws with my code below, I have created a DLL with two functions with an overload

Public Function Config(ByVal strIOAddress As String) As String
        'Function:  This sets settings on the ADAM Module

        '%AANNTTCCFF
        'AA = Address in hex
        'NN = Address to set the ADAM Module to
        'TT = Type code Always = 40 for ADAM Modules 4050-68
        'CC = Baud Rate
        '   03      1200bps
        '   04      2400bps
        '   05      4800bps
        '   06      9600bps
        '   07      19.2kbps
        '   08      38.4Kbps
        '   09      57.6Kbps
        '   0A      115.2Kbps
        '
        ' FF = Checksum Status and Protocol
        '
        '   Bits        Function
        '    0          Always set to 0
        '    1          Always set to 0
        '    2          Selection of Protocol (0 = Advantech(ASCII), 1 = Modbus)
        '    3          Always set to 0
        '    4          Always set to 0
        '    5          Always set to 0
        '    6          Selection Checksum (0 = Disabled, 1 = Enabled)
        '    7          Always set to 0
        Dim strPacket As String
        Dim checksumprotocol As String = Bin2Hex("00" & Protocol & "000" & Checksum & "0")
        strPacket = "%" & Address & strIOAddress & TypeCode & BaudRate & checksumprotocol
        MsgBox(strPacket)
        Return strPacket
    End Function
    Public Overloads Function Configuration() As String
        'LOOK IN ABOVE FUNCTION FOR DETAILS
        MsgBox("hello")
        Return Config(Address)
    End Function
    Public Overloads Function Configuration(ByVal strIOAddress As String) As String
        'LOOK IN ABOVE FUNCTION FOR DETAILS
        MsgBox("hello")
        Return Config(strIOAddress)
    End Function

This just should return a string

I reference the DLL and call the code like this in another program

Private adammodule As New ADAM_DLL.CommandSet()

Dim packet As String = adammodule.Configuration()
MsgBox(packet)

The msgbox(packet) comes back as nothing and neither of the msgbox's in the DLL appear

I can successfully call other functions in the DLL and they work fine
And yes i have updated the DLL so that the program has the most up to date version of it

Thanks
Adam
0
Comment
Question by:adam_pedley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 6

Expert Comment

by:etmendz
ID: 12315865
Looky here:

    Public Overloads Function Configuration() As String
        'LOOK IN ABOVE FUNCTION FOR DETAILS
        MsgBox("hello")
        Return Config(Address) ' <-- ding! ding! ding!
    End Function

Where did Address come from? Did you initialize it anywhere?

Have fun.
0
 
LVL 6

Accepted Solution

by:
etmendz earned 2000 total points
ID: 12315892
This should be easy to trace if you breakpoint and step debug. I recommend that you step debug so you'll know what's happening on every line you're interested in... MsgBox() debugging technique's not so cute...

Have fun.
0
 
LVL 4

Author Comment

by:adam_pedley
ID: 12315932
Address was initialised elsewhere

I found the problem, even though i remove the reference to the DLL in vb .net then readded it after a recompile of the DLL it still didnt add the new one

So it was a stupid mistake

Thanks anyway
0
 
LVL 4

Author Comment

by:adam_pedley
ID: 12315946
I would only step debug if some strange things were happening, but a msgbox to quickly find out if it gets to that point in the code is alot quicker
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This tutorial demonstrates one way to create an application that runs without any Forms but still has a GUI presence via an Icon in the System Tray. The magic lies in Inheriting from the ApplicationContext Class and passing that to Application.Ru…
If you're writing a .NET application to connect to an Access .mdb database and use pre-existing queries that require parameters, you've come to the right place! Let's say the pre-existing query(qryCust) in Access takes a Date as a parameter and l…
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

604 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question