?
Solved

VB.net SAP Connector Error in converting C# to VB.net

Posted on 2013-12-14
6
Medium Priority
?
1,444 Views
Last Modified: 2013-12-19
Hi I am getting the error below on the line marked ERROR HERE in the following VB.net code, which I converted using an online tool from the C# code below.

Error      3      Class 'SAPSystemConnect' must implement 'Event ConfigurationChanged(destinationName As String, args As RfcConfigurationEventArgs)' for interface 'SAP.Middleware.Connector.IDestinationConfiguration'.

Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports SAP.Middleware.Connector


Public Class SAPSystemConnect

    Implements IDestinationConfiguration 'ERROR HERE
    Public Function ChangeEventsSupported() As Boolean
        Throw New NotImplementedException()
    End Function

    Public Event ConfigurationChanged As RfcDestinationManager.ConfigurationChangeHandler

    Public Function GetParameters(destinationName As String) As RfcConfigParameters
        Dim parms As New RfcConfigParameters()
        If "Dev".Equals(destinationName) Then
            parms.Add(RfcConfigParameters.AppServerHost, "000.000.000.000")
            parms.Add(RfcConfigParameters.SystemNumber, "95")
            parms.Add(RfcConfigParameters.User, "sap_user")
            parms.Add(RfcConfigParameters.Password, "xxxxxxxxxx")
            parms.Add(RfcConfigParameters.User, "10")
            parms.Add(RfcConfigParameters.User, "EN")
            parms.Add(RfcConfigParameters.User, "5")
            parms.Add(RfcConfigParameters.User, "10")
            parms.Add(RfcConfigParameters.User, "600")
        End If

        Return parms

    End Function

End Class



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using SAP.Middleware.Connector;

namespace SAP_Connect_CSharp
{
    class SAPSystemConnect:IDestinationConfiguration
    {
        public bool ChangeEventsSupported()
        {
            throw new NotImplementedException();
        }

        public event RfcDestinationManager.ConfigurationChangeHandler ConfigurationChanged;

        public RfcConfigParameters GetParameters (string destinationName)
        {
            RfcConfigParameters parms = new RfcConfigParameters();
            if ("Dev".Equals(destinationName))
            {
                parms.Add(RfcConfigParameters.AppServerHost, "000.000.000.000");
                parms.Add(RfcConfigParameters.SystemNumber, "95");
                parms.Add(RfcConfigParameters.User, "sap_user");
                parms.Add(RfcConfigParameters.Password, "xxxxxxxxxx");
                parms.Add(RfcConfigParameters.User, "10");
                parms.Add(RfcConfigParameters.User, "EN");
                parms.Add(RfcConfigParameters.User, "5");
                parms.Add(RfcConfigParameters.User, "10");
                parms.Add(RfcConfigParameters.User, "600");
            }

            return parms;

        }

    }
}
0
Comment
Question by:Murray Brown
  • 3
  • 2
6 Comments
 
LVL 22

Expert Comment

by:p_davis
ID: 39718738
I would have to think that you are not implementing all the items in the interface.
0
 

Author Comment

by:Murray Brown
ID: 39718743
I should have mentioned that I also get the following two errors
Error      4      Class 'SAPSystemConnect' must implement 'Function ChangeEventsSupported() As Boolean' for interface 'SAP.Middleware.Connector.IDestinationConfiguration'.
Error      5      Class 'SAPSystemConnect' must implement 'Function GetParameters(destinationName As String) As RfcConfigParameters' for interface 'SAP.Middleware.Connector.IDestinationConfiguration'.
0
 
LVL 22

Assisted Solution

by:p_davis
p_davis earned 1000 total points
ID: 39718785
those are the methods you need to implement to get rid of the errors- if you are using visual studio and you click on the interface name there should be a blue box that appears underneath the first letter... if you click that it will give you options to implement and stub in the methods for you.
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 40

Accepted Solution

by:
Jacques Bourgeois (James Burger) earned 1000 total points
ID: 39718904
VB uses a different syntax to declare implementations:

Public Event ConfigurationChanged(destinationName As String, args As Object) Implements SAP.Middleware.Connector.IDestinationConfiguration
0
 

Author Comment

by:Murray Brown
ID: 39719850
Thanks James. How would the entire piece of code look with your changes? I can't seem to get it right
I tried the following and got a "Type expected" error on "SAP.Middleware.Connector.IDestinationConfiguration"

Public Class SAPSystemConnect

    Public Function ChangeEventsSupported() As Boolean
        Throw New NotImplementedException()
    End Function

    Public Event ConfigurationChanged(destinationName As String, args As Object) Implements SAP.Middleware.Connector.IDestinationConfiguration

    Public Function GetParameters(destinationName As String) As RfcConfigParameters
        Dim parms As New RfcConfigParameters()
        If "Dev".Equals(destinationName) Then
            parms.Add(RfcConfigParameters.AppServerHost, "000.000.000.000")
            parms.Add(RfcConfigParameters.SystemNumber, "95")
            parms.Add(RfcConfigParameters.User, "sap_user")
            parms.Add(RfcConfigParameters.Password, "xxxxxxxxxx")
            parms.Add(RfcConfigParameters.User, "10")
            parms.Add(RfcConfigParameters.User, "EN")
            parms.Add(RfcConfigParameters.User, "5")
            parms.Add(RfcConfigParameters.User, "10")
            parms.Add(RfcConfigParameters.User, "600")
        End If

        Return parms

    End Function

End Class
0
 

Author Closing Comment

by:Murray Brown
ID: 39731139
Thanks for the help
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

This article is for Object-Oriented Programming (OOP) beginners. An Interface contains declarations of events, indexers, methods and/or properties. Any class which implements the Interface should provide the concrete implementation for each Inter…
This article descibes how to create a connection between Excel and SAP and how to move data from Excel to SAP or the other way around.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
With just a little bit of  SQL and VBA, many doors open to cool things like synchronize a list box to display data relevant to other information on a form.  If you have never written code or looked at an SQL statement before, no problem! ...  give i…
Suggested Courses

840 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