COM works in, not C#??

I am converting a site from asp to  This site uses a COM object and I would like to use C#.  I've included aspcompat=true in my page directive.

In, it works great.......
Dim oLDS as Object
oLDS = Server.CreateObject("ldswebapi.Lookup")

In C#, not so great........
Object oLDS = new Object();    // or Object oLDS;
oLDS = Server.CreateObject("ldswebapi.Lookup");

I get error "object does not contain a definition Initialize"

I don't get it.  Can I not use C# for this?


2/17/2007 4:30:05 AM 901 articles. 0 followers. Follow

3 Replies

Similar Articles

[PageSpeed] 21

Yeah you can. The problem is that VB.NET is loose. The "object" object doesn't have a method called Initialize. Your object might, but because it is of type object, C# won't recognize it. It is like turning EXPLICIT and STRICT on in VB.NET. You would have to cast your object to a COM wrapper, or Invoke it with reflection.
       Kevin Jones

2/17/2007 5:39:24 AM
So what is an example of a COM wrapper or Invoke it w/ reflection?
2/17/2007 5:13:30 PM

you can add reference your com object in Visual Studio by right click on your project and select Add Preference. Select the dlls you want to use.

 This will create an Interop dll.

You can try the following

 using ldswebapi.Lookup;

 ldswebapi.Lookup oLDS = new ldswebapi.Lookup();



Hope this helps

3/7/2007 11:20:09 PM

Similar Artilces:

Sending SMS using or using or
Hi  My requirement is I hav one csv file with these fields id,mobilenum,messgae,status.intiallu staus is 0. once i read the all fileds and take that mobile number.using tat mobile number  i need to send sms .after sending sms i shuld change status as 1 How to send sms thru coding (please dont provide any links.if it is provide also please give working links becox i checked codeproject .i didnt get any nice link. and also provide the how to update the status field im csv file   Thank ssandhya   To send SMS, you need some third party SMS providers. if you consul...

Type.GetType does not work in VB.NET but works in C#. VB.NET gurus Please help
Friends,   I am an experienced C# programmer who is working on a VB.NET project now. I am writing different methods covering the following functionalities 1) Take a datareader as input and return an arraylist of class object2) Take an xmlnode (received from a webservice) as input and return an arraylist of class object. The methods are generic methods which take datareader/xmlnode as first parameter and classname (string) as the second parameter. This way it will work trivially. The schema of class object matches with the input (datareader or xmlnode)In C# I used to do th...

use VB.NET and C#.NET code in the same C#.NET project
All-- Here is a sample that is "off the beaten path", (at least for me). Is it possible, in an ASP.NET application, using the code-behind page building technique, to have both pages written in VB.NET and pages written C#.NET?At there is a sample that shows that, (contrary to popular belief), it IS possible to mix ASP.NET pages built with C#.NET with ASP.NET pages built with VB.NET in the same VS.NET 2003 project. Note that this is just a "fun" sample to see if it can be done and I do not recommend this practice as a "standard" way of developing. The trick is to use the "Src" attribute of the @Page directive. Check out the link if you are inclined. You are welcome to download the code if you are interested further, found at the same link. (Note that the reason that I looked for a way to do this is because I wanted to have the option to include some VB.NET-based demos at my site. Since my site is a C#.NET ASP.NET, I was told that there was no want to do this. Therefore, I looked for a workaround and just happened to find one.) Enjoy (and then get back to work!) you are right !!!mixing languages could cause unknow and uncontrolled problems !!! if a developer has to mix ....the practical way is to create a new project with different language and what will be absolutely fine !!!thanks mkamoski for raising this issue !!Fadil Alnassar | FREE Nodil Tab Controlhttp://www.mefranchisi...

How to migrate code from to
Hi all,If anybody knows information on migration of VB.Net application to i.e Any tools available, best practices, methodology for estimation. etc.   RegardsHelen    Hey, Take a look at this topic some of these sites can be of help to you.  Arnold you can do it by page by page just copy and paste ur page in the following link and convert ur to c# gotcha!!YasserSpica.www.spica.aewww.bncnetwork.netPlease remember to mark as answers i...

Migrate code from to
Hello friends, I had created a web site using visual studio 2005. web site was created using the language vb i.e. Now as per the clint requirement I have to migrate all the code in C#. So the question is that is there any tool or any inbuild utility in Visual Stuidio so that we can migrate the site from to Or we have to do it mannually i.e. by changing each and every line of code mannually? Kindly suggest me. Thanks & Regards Girish NehteThanks & RegardsGirish NehteIf This post helps you to solve your problem please mark this as an answer. Hi, at the mome...

converting to from offered me some sample code when I signed up with them the only problem is the sample code is in but my page that they type all of their credit card into is <code><%@ Import Namespace="System.Net" %> <%@ Import Namespace="System.IO" %> <script language="C#" runat="server"> void Page_Load(Object Src, EventArgs E) { myPage.Text = readHtmlPage(""); } private String readHtmlPage(string url) { ... vs vs
just out of curiousity which looks, acts most like java? i'm still learning trying to used to but it seems that it was easier to do some stuff with java. C# is Java++ in my opinion. If you have done C or Jave you will prefer C#.Mike Schellenberger - MCAD If you are looking for language similar to java go for J#. However most code samples you find on the net will be in VB.NET and C#....

what lang does everyone prefer? Thanks, Peter Iuvara, MCP It's a very famous debatable question in forums! I would say if you are from Java/C/C++, then C# would be easy to use for you. If you are from ASP/VB, then VB.NET would be easy for you! As long as if you follow CLS, then what ever the language you use, it's going to be the same for CLR!Sreedharhttp://www.w3coder.orgweblog I would agree with that ... just curious as to what user's on this forum predominantly code in?Thanks, Peter Iuvara, MCP I came from no real programming background, started i...

vb .net or c# .net
I currently develop websites using php but have been requested to develop a site using The question I have is for someone who knows php would it be better to transition to or Thanks, Fr. Robert C# -> There is a converter that will transition about 60% or more of your PHP code to C#. Plus C# is closer to PHP than VB.NET.Jason N. GaylordASPInsider and Microsoft MVP

VB.Net To C#.Net
Hello... Since Last from 1 year i had develope web application in using now i want to transfer from to so what should i do to transform to c# language any link or book related to me through i can easily understand and coding using c# in a short time... Thanks~ Mark As Answer If UseFull ~Kaushal. Hi, you can read the specifications of the language. You're already familiar with .NET and how to program in an OO manner thanks to your experience with The only thing you need to learn is the new syntax of C#. You can also convert parts of your v...

Help Me C# is working But Not working
Edited by SomeNewKid. Please post code between <code> and </code> tags. Pls, Help me, It is simple chat programe. My <IFRAME> src is calling the bellow event in C# it is working perfectly. private void Page_Load(object sender, System.EventArgs e) { string sDealer=""; string sWrite=""; if ( Session["Channel"] != null ) sDealer = Session["Channel"].ToString(); Response.Write( "<meta http-equiv=\"Refresh\"content=\"4\">" ); sWrite=MyModule.MyChat.GetAl... and same app
Been asked before, but... If I build a c# web app and someone builds a desktop app, can they communicate? and can you develop against my c# web app, can I add the desktop app as a reference? or at least make calls to it? web apps or desktop apps can contain components created in either language. i have a web solution that contains 4 projects. One of the projects is C# the others are VB.Mike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: Thanks...that is what I was looking for ...

Converting from to
Hello I have recently purchased VBGolds RawDataPrinter which should allow users to print directly to label printers on our network directly from a c# web form.  Unfortunately they only supply examples and I have need of c#.  The component has been installed on our web server.  This is some code that they have supplied as examples in   "-//W3C//DTD XHTML 1.0 Transitional//EN" ""> <html xmlns="" >"Head1" runat="server&qu...

use of and
i make a small website using,  in it i make a 2 class in that i want to use in that website, i dont know how to call that class. let your class is  - class clsMyClass    {        public void myFunction()        {            // do something        }    } now the first way - create objectclsMyClass myObj = new clsMyClass();myObj.myFunction(); // call function================...

Difference Between VB.Net And C#.Net
 hi friends,Please tell me the key difference between the Vb.Net And C#.Net..wheather supports operator overloading..Thanks & Regards,Pravin Kumar T.   Regards,Pravin Kumar T. pravin_thanusu:Please tell me the key difference between the Vb.Net And C#.Net.. Neither are ASP.NET so you probably want a different forum.  You'll also find your answers at JeffPlease: Don't forget to click "Mark as Answer" on the post that helped you. That way future readers will know which post solved your issue.  >Please tell me the k...

how can i write this line using : container.dataitem ?.... in its not working
Dim container As GridView = CType(newLinkButton.NamingContainer, GridView) Dim dataValue As Object = DataBinder.Eval(container.dataitem, _ColName)   _ColName its just a string a name of the field in my database   This is Vb.Net code man what you want? You can convert any format from this link  If this post is answer of your question then don't forgot to Click Mark As Answer...

convert page to
ok I have an entire page in and now I want to integrate some code from another page but it written in what is the easiest way to convert to I tried using but it only gave me errors here is what I am trying to convert let me know if you have any ideas With Alex Lowe's translator ' Messages Private NoFileMessage As String = "No file selected" Private UploadSuccessMessage As String = "Uploaded Sucess" Private NoImagesMessag...

Call to non .net COM not working after .NET
I have developed small samples of ASP.NET and one of them I tried to call a standard COM (non .NET). I took the code out for now, but a call to that COM from traditional ASP application now does not work. Does anyone have an idea how to correct this?...

Structures in VB.NET > C#.NET
Hello,I have a VB.NET codePublic Structure MyDates    Dim _Title as String    Dim _Date as DateTimeEnd StructureSOME CODE GOES HERE temp = New MyDates()While(myDataReader.Read()) temp._Title = myDataReader.Item("Title")   -------------------------------------------------------------------------I have written this using C#.NET.Here is the code public struct MyDates    {        string _Title;        DateTime _Date;       ...

Integrating the and application
Hello All,  I'm trying to integrate the application and application.  Can you give me any suggestions of how to merge them.  Thanks in Advance You are probably goign to have to convert one of the applications to the other language at one point.  There are online conversion tools to help WilliamPlease mark the most helpful reply/replies as "Answer".Give some of my PWSK modules a try.  Type of application?We All move to our original place.Don't forget.Imran Baloch @weighfield: I d...

Convert VB.Net application to
Haican any one help me to convert VB.Net application in this link to Palavila  Regards Anu Palavila Use this Free Conversion tool -  ASP.NET Grid With Excel Capabilities | 27 GridView Tips & Tricks | Hosting your site? | SQL Server Tips Other Code Convertors (convert VB to C# and C# to VB)

How to change code to C#.Net ?...
Hi, Earlier i had a class  that i got it from this Forum, it in and i am trying it to convert it in but i am unable to covert properly to work. the functionality of this class is to convert number value to words. i am putting both of code and please rectify it.Public Class NumberToWords Dim Character As String Public Function ConvertNumber(ByVal A As Double) As String On Error Resume Next Dim MM Dim IM ConvertNumber = "" MM = Microsoft.VisualBasic.Len(A) IM = Microsoft.VisualBasic.Left(A, Mic...

Can VB.NET and C#.NET combined?
Hi, I have a web application so far written in VB.NET using Web Matrix. I need to create a chat program like MSN ... but I wish to use C#.NET to create this chat program, so I can learn about it ... can I combined VB.NET and C#.NET in the same application? Hello, I thought you could have a look at this: Mixing VB and C# in same Web Application regards.Bilal Hadiar, MCP, MCTS, MCPD, MCTMicrosoft MVP - Telerik MVP I don't recommend mixing the two in the same application (if is even possible), but what you can do is encapsulate all of your logic into an asembly (dll) written in c# and ...

is it true, that is a wrapper to
is it true, that is a wrapper to can anyone validate that? and if so, what source? Thanx Kamran Sorathia No, it is not true. See this: Programming Languages (Designing Distributed Applications with Visual Studio .NET) These languages are mainly equal, though they do have differences mainly related to what their compiler does and what the corresponding dev team at MS has had in mind when they've though out the features. Both languages have t...

Web resources about - COM works in, not C#?? -

Energized Work
Fat free approach. No bureaucracy. No waste. Just common sense,disciplined technique, and radical transparency.

Financial Wisdom Works
Home Staff Privacy Policy Contact Search for: News Budgeting Education Debt Insurance Retirement Investing Credit Cards Teach Kids Financial ...

Research Works Act - Wikipedia, the free encyclopedia
The Research Works Act , also known as H.R. 3699, is a bill that was introduced in the United States House of Representatives at the 112th United ...

Gay concedes 'teething problems' in work to reduce Sydney Airport road gridlock
Consider the train when it's essential to get to the airport, says Duncan Gay.

Va. says suicide hotline improvements were in the works Va. says suicide hotline improvements were in the works Improvements were underway at the Veterans Affairs suicide ...

Kojima, del Toro vow to work together again after Silent Hills debacle
... like an odd professional and artistic partnership. In a wide-ranging talk on the DICE stage Thursday, though, both creators detailed a working ...

Now you can live in a dorm-like apartment building where neighbors use a work app called Slack to communicate ...
Slack is a hot San Francisco startup that makes a chat app for the workplace. Now, it's coming to a dorm-like apartment building in the trendy ...

Donald Trump: "Torture works"
The GOP frontrunner also said the U.S. should "go much stronger" than waterboarding

The Sun: Prince William is ‘quite petulant’ & ‘a bit bored’ with his pilot work
... here to read . This event in Wales today was only William’s second event of the year. The excuse being used for William’s lack of royal work ...

Deadpool 2 Movie Is Already In The Works
Now that Deadpool has made it out of development hell and into box office heaven, setting opening weekend records for an R-rated movie and for ...

Resources last updated: 2/19/2016 4:51:47 AM