473,387 Members | 1,407 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

translate code into c# from vb.net

Joe
Hello,

I have been trying to convert this vb.net code snippet below into c#
for a couple days and I have had no luck. Maybe someone out there can
point in the right direction.

Dim iPersist As IPersistStreamInit.

iPersist = CType(PDF1.GetOcx, IPersistStreamInit)
iPersist.GetSizeMax(len)

PDF1 is an activex control.
I've tried this below without any luck.
IPersistStreamInit iPersist = (IPersistStreamInit)this.PDF1.GetOcx();
iPersist.GetSizeMax(size);

Thanks All,
Nov 16 '05 #1
4 1802

Try this one, eventhough it looks quite similar to what you already tried.

IPersistStreamInit iPersist;
iPersist = ((IPersistStreamInit)PDF1.GetOcx);
iPersist.GetSizeMax(len);

Yonas

"Joe" <pi****@hotmail.com> wrote in message
news:27**************************@posting.google.c om...
Hello,

I have been trying to convert this vb.net code snippet below into c#
for a couple days and I have had no luck. Maybe someone out there can
point in the right direction.

Dim iPersist As IPersistStreamInit.

iPersist = CType(PDF1.GetOcx, IPersistStreamInit)
iPersist.GetSizeMax(len)

PDF1 is an activex control.
I've tried this below without any luck.
IPersistStreamInit iPersist = (IPersistStreamInit)this.PDF1.GetOcx();
iPersist.GetSizeMax(size);

Thanks All,

Nov 16 '05 #2
The equivalent C# is:

IPersistStreamInit. iPersist;
iPersist = (IPersistStreamInit)(PDF1.GetOcx());
iPersist.GetSizeMax(len);

obtained via our Instant C# VB.NET to C# converter - download the Demo
Edition at http//www.instantcsharp.com

What sort of compiler errors are you getting? A common problem with
accessing COM objects is that the methods may have optional
parameters, which are not optional when accessed from C#.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #3
Yes, there is that period after IPersistStreamInit that shouldn't be
there - our converter left it in - garbage in garbage out.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*
Nov 16 '05 #4
Joe
da**@tangiblesoftwaresolutions-dot-com.no-spam.invalid (David Anton) wrote in message news:<41**********@Usenet.com>...
The equivalent C# is:

IPersistStreamInit. iPersist;
iPersist = (IPersistStreamInit)(PDF1.GetOcx());
iPersist.GetSizeMax(len);

obtained via our Instant C# VB.NET to C# converter - download the Demo
Edition at http//www.instantcsharp.com

What sort of compiler errors are you getting? A common problem with
accessing COM objects is that the methods may have optional
parameters, which are not optional when accessed from C#.

*-----------------------*
Posted at:
www.GroupSrv.com
*-----------------------*


Hi Dave,

Thanks for the input but "len" seems to always be zero.
iPersist.GetSizeMax(len);

Let me know if you have any suggestions.

Thanks
Nov 16 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Bengt Richter | last post by:
Just thought None as the first argument would be both handy and mnemonic, signifying no translation, but allowing easy expression of deleting characters, e.g., s = s.translate(None,...
1
by: Xeon | last post by:
Hi, I'm trying to replace spaces with %20 with help of translate, but not successfull. Here's a node in the xml file : <title>This is some test title</title> The xsl code I'm using : ...
7
by: Johnny Lee | last post by:
Hi, First, I want to know whether the python interpreter translate the code directly into machine code, or translate it into C then into machine code? Second, if the codes are translated directly...
6
by: VBTricks.de.vu Webmaster | last post by:
Hello, in VB6 I used to translate my application by setting the tag-property of all controls, menu-entries... to a number which has been linked to a string (array). Then I went through all...
6
by: bobueland | last post by:
The module string has a function called translate. I tried to find the source code for that function. In: C:\Python24\Lib there is one file called string.py I open it and it says
1
by: peterbe | last post by:
This has always worked fine for me. Peter fine Now if I do it with a unicode string: Traceback (most recent call last): File "<stdin>", line 1, in ? File "/usr/lib/python2.4/string.py", line...
9
bvdet
by: bvdet | last post by:
I have done some more work on a simple class I wrote to calculate a global coordinate in 3D given a local coordinate: ## Basis3D.py Version 1.02 (module macrolib.Basis3D) ## Copyright (c) 2006...
3
by: amija0311 | last post by:
Hi, I am new using DB2 9.1 database by windows base. I want to query the data that contain string then translate the string into integer using DB2. The problems is If the data is null, i got the...
3
by: Kenneth McDonald | last post by:
I have the need to occasionally translate a single word programatically. Would anyone have a Python script that would let me do this using Google (or another) translation service? Thanks, Ken
4
by: kovariadam | last post by:
Hi, Does anybody know why i get this error: SQL0176N The second, third or fourth argument of the TRANSLATE scalar function is incorrect. SQLSTATE=42815 with this query: SELECT...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.