Set objMapWindow = gobjGeoApp.ActiveWindow - vb.net

above following command is written in VB, where objMapWindow is object,how to write same command in C#.

try these
dynamic objMapWindow = gobjGeoApp.ActiveWindow;
object objMapWindow = gobjGeoApp.ActiveWindow;

Related

Convert Excel VBA to C++Builder OLE API

how to convert the following VBA code to c++ builder in OLE? Thanks.
Range("A10:B28").Select
ActiveSheet.Shapes.AddChart2(240, xlXYScatter).Select
ActiveChart.SetSourceData Source:=Range("Sheet1!$A$10:$B$28")
ActiveSheet.Shapes("test1").IncrementLeft -288.5293700787
ActiveSheet.Shapes("test1").IncrementTop -39.7059055118
I have tried the following code, the c++ builder crash at last line
#include <excel_2k.h>
outXL = Variant::CreateObject("excel.application");
outXL.OlePropertySet("Visible", true);
outWorkbooks = outXL.OlePropertyGet("Workbooks");
outWorkbook = outWorkbooks.OleFunction("Open", "D:\\test.xls");
outWorkSheets = outWorkbook.OlePropertyGet("Worksheets");
outActiveSheet = outWorkbook.OlePropertyGet("Worksheets", 0);
outActiveSheet.OlePropertyGet("Activate");
Range=outActiveSheet.OlePropertyGet("Range",
outActiveSheet.OlePropertyGet("Cells",5,1),
outActiveSheet.OlePropertyGet("Cells",20,2));
Chart = outActiveSheet.OlePropertyGet("Shapes").OleFunction("AddChart2");
//=========This line Dump ERROR=========
Chart.OlePropertySet("ChartType",xlXYScatter);
IDK, if this is the answer, but ISTM you need to modify the code here
Chart = outActiveSheet.OlePropertyGet("Shapes").OleFunction("AddChart2", 240, xlXYScatter);
That is the way it is called in the VBA. You just have OleFunction("AddChart2")
What is the value of Chart after the function call?
I have fixed this issue, please reference the following code...
Chart = outXL.OlePropertyGet("Charts").OleFunction("Add");
Chart.OlePropertySet("ChartType", xlXYScatter);
Range=outActiveSheet.OlePropertyGet("Range",
outActiveSheet.OlePropertyGet("Cells",iDrawRowFrom,iDrawColFrom),
outActiveSheet.OlePropertyGet("Cells",iDrawRowTo,iDrawColTo));
Chart.OleProcedure("SetSourceData", Range);
Chart.OleFunction("Location", 2, strOutSheetName.c_str());

Changes in lua language cause error in ai script

When I run script in game, I got an error message like this:
.\AI\haick.lua:104: bad argument #1 to 'find' (string expected, got nill)
local haick = {}
haick.type = type
haick.tostring = tostring
haick.require = require
haick.error = error
haick.getmetatable = getmetatable
haick.setmetatable = setmetatable
haick.ipairs = ipairs
haick.rawset = rawset
haick.pcall = pcall
haick.len = string.len
haick.sub = string.sub
haick.find = string.find
haick.seed = math.randomseed
haick.max = math.max
haick.abs = math.abs
haick.open = io.open
haick.rename = os.rename
haick.remove = os.remove
haick.date = os.date
haick.exit = os.exit
haick.time = GetTick
haick.actors = GetActors
haick.var = GetV
--> General > Seeding Random:
haick.seed(haick.time())
--> General > Finding Script Location:
local scriptLocation = haick.sub(_REQUIREDNAME, 1, haick.find(_REQUIREDNAME,'/[^\/:*?"<>|]+$'))
Last line (104 in file) causes error and I don`t know how to fix it.
There are links to .lua files below:
https://drive.google.com/file/d/1F90v-h4VjDb0rZUCUETY9684PPGw7IVG/view?usp=sharing
https://drive.google.com/file/d/1fi_wmM3rg7Ov33yM1uo7F_7b-bMPI-Ye/view?usp=sharing
Help, pls!
When you use a function in Lua, you are expected to pass valid arguments for the function.
To use a variable, you must first define it, _REQUIREDNAME in this case is not available, haick.lua file is incomplete. The fault is of the author of the file.
Lua has a very useful reference you can use if you need help, see here

Cannot pass parameters into a .rdlc file

I receive an error when running the following code. It throws an error when i try to set the parameters on the report. I looked everywhere but cannot seem to find an answer what I am doing wrong here. Every example has this method to pass parameters. Any insight would be greatly appreciated.
Me.ReportViewer1.Clear()
Me.ReportViewer1.LocalReport.ReportEmbeddedResource = "Stock_Centric.OrderPrint.rdlc"
Me.ReportViewer1.LocalReport.DataSources.Clear()
Me.ReportViewer1.LocalReport.DataSources.Add(NewMicrosoft.Reporting.WinForms.ReportDataSource("dsOrderItems", dtItems.DefaultView))
Me.ReportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout)
Dim paramtr(4) As ReportParameter
paramtr(0) = New ReportParameter("Type", "Sale")
paramtr(1) = New ReportParameter("Company", "Jabu")
paramtr(2) = New ReportParameter("Direction", "Out")
paramtr(3) = New ReportParameter("OrderNum", "53")
paramtr(4) = New ReportParameter("Reference", "Kukashop 123")
ReportViewer1.LocalReport.SetParameters(paramtr)
Me.ReportViewer1.RefreshReport()
Error: System.InvalidCastException: 'Unable to cast object of type 'Microsoft.Reporting.WebForms.ReportParameter[]' to type 'System.Collections.Generic.IEnumerable`1[Microsoft.Reporting.WinForms.ReportParameter]'.'
All your parameters are in a form of strings?

Writing a Groovy Script to execute this command to PostgresDB

I currently am using SOAPUI 4.0 Pro to hit a Postgresdb on a specific host. I have modified my properties file to include port, username, and password and name of database. Here is my query below:
SELECT
eis_entity.local_id,
eis_trait_instance_history.trait_value,
eis_identifier_domain.identifier,
eis_identifier_domain.label
FROM
public.eis_entity,
public.eis_trait_instance_history,
public.eis_version_label,
public.eis_identifier_domain
WHERE eis_identifier_domain.eis_identifier_domain_key = eis_entity.eis_identifier_domain_key
AND eis_entity.eis_entity_key=eis_version_label.eis_entity_key
AND eis_version_label.eis_version_label_key=eis_trait_instance_history.eis_version_label_key
AND eis_trait_instance_history.trait_value='<name of patient>';
How would I create a groovy script for the query above?
Assuming you can pick up Groovy SQL basics and have a handle on a sql instance...
sql = Sql.newInstance(...)
def List eisEntityList = sql.rows("""
SELECT eis_entity.local_id,
eis_trait_instance_history.trait_value,
eis_identifier_domain.identifier,
eis_identifier_domain.label
FROM public.eis_entity,
public.eis_trait_instance_history,
public.eis_version_label,
public.eis_identifier_domain
WHERE eis_identifier_domain.eis_identifier_domain_key = eis_entity.eis_identifier_domain_key
AND eis_entity.eis_entity_key = eis_version_label.eis_entity_key
AND eis_version_label.eis_version_label_key = eis_trait_instance_history.eis_version_label_key
AND eis_trait_instance_history.trait_value = ''
""")
if (eisEntityList?.size() > 0) {
eisEntityList.each {
// do something with each item...
}
}

Powershell Pull Current OU

I need to be able to pull the current machine OU. I found some VB code that could do this,but I would like to just be able to do in the script with out having to call VB. Any ideas, the VB code is below.
Set objSysInfo = CreateObject("ADSystemInfo")
DN = objSysInfo.ComputerName
WScript.Echo DN
-Josh
You can get the ADSystemInfo with this function.
function Get-LocalLogonInformation
{
try
{
$ADSystemInfo = New-Object -ComObject ADSystemInfo
$type = $ADSystemInfo.GetType()
New-Object -TypeName PSObject -Property #{
UserDistinguishedName = $type.InvokeMember('UserName','GetProperty',$null,$ADSystemInfo,$null)
ComputerDistinguishedName = $type.InvokeMember('ComputerName','GetProperty',$null,$ADSystemInfo,$null)
SiteName = $type.InvokeMember('SiteName','GetProperty',$null,$ADSystemInfo,$null)
DomainShortName = $type.InvokeMember('DomainShortName','GetProperty',$null,$ADSystemInfo,$null)
DomainDNSName = $type.InvokeMember('DomainDNSName','GetProperty',$null,$ADSystemInfo,$null)
ForestDNSName = $type.InvokeMember('ForestDNSName','GetProperty',$null,$ADSystemInfo,$null)
PDCRoleOwnerDistinguishedName = $type.InvokeMember('PDCRoleOwner','GetProperty',$null,$ADSystemInfo,$null)
SchemaRoleOwnerDistinguishedName = $type.InvokeMember('SchemaRoleOwner','GetProperty',$null,$ADSystemInfo,$null)
IsNativeModeDomain = $type.InvokeMember('IsNativeMode','GetProperty',$null,$ADSystemInfo,$null)
}
}
catch
{
throw
}
}
You can't use ADSystemInfo directly in Powershell (or at least it's not easy) according to this page
Well, OK, that’s not entirely true; it is possible to use ADSystemInfo from within PowerShell; however, the process is far from easy and even farther from being intuitive. That’s because ADSystemInfo is lacking a “wrapper” that makes it easy to access the object from a .NET language like Windows PowerShell. That results in a lot of gyrations involving .NET Reflection classes, the InvokeMember method, and, as near as we can tell, a lot of prayer.
But the page does provide examples for performing AD queries using the System.DirectoryServices.DirectorySearcher .NET object. Here's an example from the page slightly modified to match your VB script:
$strName = $env:computername
$strFilter = "(&(objectCategory=Computer)(Name=$strName))"
$objSearcher = New-Object System.DirectoryServices.DirectorySearcher
$objSearcher.Filter = $strFilter
$objPath = $objSearcher.FindOne()
$objPath.GetDirectoryEntry().distinguishedname