facebook c# SDK vb.net issue - vb.net

i have been trying to use this sdk with vb.net with dynamic, using the vb sample thats on the site and im getting an error
"Public member 'id' on type 'JsonObject' not found."
thats in the sample GetSampleWithAccessToken referring to is
Dim id = result.id

You're giving too little context, but it seems that result is typed as JsonObject, while it should be typed explicitly as Object for the dynamic features of VB to kick in.
Dim result as Object = ...
Dim id = result.id

Related

In ETAS INCA, how can I extract specific calibration values by accessing the COM-API via VBA?

I'm trying to construct a VBA script that opens INCA and extracts specific calibration values.
To start, I found a Youtube video by ETAS (https://www.youtube.com/watch?v=OQAvE0UT5xk), and I copied the code from there:
Private Function inca_com_api() As Variant
Dim Inca As Object
Dim DB As Object
Dim DBname As String
Dim devices() As Variant
Dim calValue As Variant
Set Inca = CreateObject("inca.inca")
Set DB = Inca.GetCurrentDataBase
DBname = DB.GetName
inca_com_api = DBname
Inca.DisconnectFromTool
End Function
The code opens INCA and runs as intended, returning the database name, but what I want is not the database name, but specific calibration values.
I was under the impression that I could just use the API functions listed in the User's Guide for INCA-MIP (https://www.etas.com/en/downloadcenter/18008.php), which is the INCA COM-API interface package for Matlab.
I don't have INCA-MIP, I just thought I could call those functions through VBA, by using the same function name or similar function names.
But when I try code like:
devices() = DB.IncaGetDevices
or
devices() = DB.GetDevices
or
devices() = Inca.IncaGetDevices
or
devices() = Inca.GetDevices
or the same variations of GetCalibrationValue, IncaGetCalibrationValue, I get:
Run-time error '438': Object doesn't support this property or method
I was planning to use IncaGetDevices to show me a device name, which I could then use as an input argument for IncaGetCalibrationValue, for each of my specific calibration names that I want returned.
Again, I don't have INCA-MIP, but I am wondering how I can return these calibration values using the VBA and the COM-API for INCA?
Also, I tried looking through the following posts for answers:
In ETAS INCA, is there a way to quickly retrieve an item from an arbitrary path in an ASAP2Project?
In ETAS INCA, what classes correspond to each type of database item?
but I don't really know what they're talking about.
Any help would be appreciated, thanks

Automapper with Anonymous list in VB.Net

I'm having a problem getting Automapper to work correctly with Lists of anonymous types VB.Net. I've found a few examples on-line in C# but cannot get them to compile let alone work once converted to VB.Net. Code below is a simplified version of what I am trying to do. The errors I am getting with the code below are "Type argument cannot be inferred from usage" on the select and "Incorrect number of arguments" in DynamicMap but I have tried loads of variations each fixes one problem and creates at least one more.
Any help would be much appreciated as I have been looking at this for over a day.
Public Function OrgList() As List(Of OrganisationListSelectVm)
Dim orgs = (From o In EntityModel.Organisations
Join r In EntityModel.Regions On o.RegionID Equals r.RegionID
Order By o.OrganisationName
Select
o.OrganisationID,
o.OrganisationName,
o.OrganisationCode,
o.RegionID,
r.RegionName).ToList()
'** mapping one item works fine
Dim oneItem = Mapper.DynamicMap(Of OrganisationListSelectVm)(orgs(0))
'** C# mapper from various web sites
'var result = orgs.Select(Mapper.DynamicMap<OrganisationListSelectVm>).ToList();
'** VB converted type which fails
Dim result As List(Of OrganisationListSelectVm) = orgs.[Select](Mapper.DynamicMap(Of OrganisationListSelectVm)).ToList()
Return result
End Function

Reading and changing fields in SAP with RFC via VB .NET

I'm currently trying to figure out the basics of remote function calls via vb .NET. I feel pretty helpless however, because their just isn't any useful documentation for the most simple of tasks.
What I'm trying to do atm is starting the transaction CO13, write the confirmation number in the appropriate field and cancel the order. Even this simple tasks turned out to be a pain in the ass. I'm still not sure how to access and modify the contents of a specific field. There are some examples with tables for excel in the net, but hat's about it. What I have so far is this (login is working and in another function):
Public Function stornieren() As Boolean
Dim ordernr As String
Dim confirmationnr
Dim confirmation As Object
Dim R3 As Object
Dim CO13 As Object
Dim result
R3 = CreateObject("SAP.Functions")
ordernr = TextBox3.Text
confirmationnr = TextBox4.Text
CO13 = R3.Add("RFC_CALL_TRANSACTION_USING")
CO13.exports("TCODE") = "CO13"
CO13.exports("MODE") = "S"
confirmation = CO13.exports("RUECK")
confirmation.value = confirmationnr
result = CO13.call
End Function
RUECK is the Field Name. I want to write the value of "confirmationnr" into the field RUECK. "confirmation.value = confirmationnr" throws the error message "the object variable could not be determined" and "NullReferenceException" was not handled. Sounds to me like the object is empty.
Thanks in advance.
EDIT: Now trying via BAPIs and particularly BAPI_PRODORDCONF_CANCEL. I have no idea about the syntax though. Any help would be appreciated.

Using Python how do i handle a VBA API asking for type 'object'

I'm brand new to Python, I'm using 3.3. I began to explore COM, and what you can do with it is incredible for an engineer. I'm an engineering undergrad student, so I've got enough programming skills to get by, but I don't actually understand what I'm really doing.
The project I'm starting with has an excellent API help if I were writing in VBA, VB.NET, C# or C++ but I'm doing this project in Python and I'm two lines of code away from being done. I'm struggling with the second last "Method" of the program.
the API help offers this VBA description of the Method I'm trying to access.
For VBA:
Dim instance As (a handle?? to the class??? of this method, I know I've got a proper object)
Dim NElementNumber As Integer
Dim NStepNum As Integer
Dim DispPlane As Object (API says if you don't have a value to use, use Nothing, they literally type Nothing in in the provided examples)
Dim NUnits As Integer
Dim value As Object
value = instance.Method(NElementNumber, NStepNum, DispPlane, NUnits, ErrorCode)
and my python shell spits back to me
"Results = instance.Method(i,1,nothing,3,0)
File "<COMObject <unknown>>", line2, in Method
TypeError: Objects of type 'object' can not be converted to a COM VARIANT"
so I'm confused because, I have an idea what the problem is, obviously somehow i need to make the other program see that 'Nothing' entry as an object like it's expecting. But how do I go about doing that? what kind of Object are there many kinds of Objects?

Conversion from type 'String' to type 'String' is not valid

I'm in the process of porting an old excel addin that was writen in VBA to VB .NET. The Excel addin interacts with a number of external com objects. The code sorta looks like this:
Dim hurr as Object
Dim durr as String
hurr = CreateObject("COM Object")
durr = hurr.getString
What I'm trying to do is read the string from the COM object and get it in durr for use later in my program.
That second line results in the exception posted above. If I try casting with CStr/CType I get the same exception. The visual studio watch window reports the type of hurr.getString as a "System.__ComObject" whereas the VBA watch window reports the type as "Variant/Object/String". Microsoft.VisualBasic.Information.TypeName(hurr.getString) says the type is "String". Any ideas how I should go about getting this working?
Thanks!
This is ridiculous but I figured I would post the answer here for completeness. The solution was to add a pair of brackets to the end of hurr.getString
so the working code looks like this:
Dim hurr as Object
Dim durr as String
hurr = CreateObject("COM Object")
durr = hurr.getString()
The above code gave me the casting exception and for whatever reason it needs brackets to work here. I'm just going to add that working with late binding com objects is horrible and should be avoided at all costs.