473,385 Members | 1,764 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,385 software developers and data experts.

No method in C# but exists in VB?

Sorry for all the post on conversion from VB.NET to C#. Just can't figure
some of these out. getElementsByTagName method is fine in VB but get this
error in C#:

Object does not contain a signature for getElementsByTagName

Intellisense in both langauges is the same.

[VB.NET]
Private WithEvents IE_Inst As New SHDocVw.InternetExplorer
Dim wbrAll As mshtml.IHTMLElementCollection = _
Me.IE_Inst.Document.("input")

[C#]
private SHDocVw.InternetExplorer IE_Inst = new SHDocVw.InternetExplorer();
this.IE_Inst.Document.getElementsByTagName("input" );

What did I miss in C# that VB.NET picked up?

Thanks,
Brett
Nov 17 '05 #1
8 5041
C# is casse sentitive - Did you mean to use a capital G at the start of the method name?

Regards

RIchard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Sorry for all the post on conversion from VB.NET to C#. Just can't figure
some of these out. getElementsByTagName method is fine in VB but get this
error in C#:

Object does not contain a signature for getElementsByTagName

Intellisense in both langauges is the same.

[VB.NET]
Private WithEvents IE_Inst As New SHDocVw.InternetExplorer
Dim wbrAll As mshtml.IHTMLElementCollection = _
Me.IE_Inst.Document.("input")

[C#]
private SHDocVw.InternetExplorer IE_Inst = new SHDocVw.InternetExplorer();
this.IE_Inst.Document.getElementsByTagName("input" );

What did I miss in C# that VB.NET picked up?

Thanks,
Brett

Nov 17 '05 #2
Tried that but it doesn't work either. Any other suggestions?

Thanks,
Brett
"Richard Blewett [DevelopMentor]" <ri******@NOSPAMdevelop.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
C# is casse sentitive - Did you mean to use a capital G at the start of
the method name?

Regards

RIchard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Sorry for all the post on conversion from VB.NET to C#. Just can't
figure
some of these out. getElementsByTagName method is fine in VB but get this
error in C#:

Object does not contain a signature for getElementsByTagName

Intellisense in both langauges is the same.

[VB.NET]
Private WithEvents IE_Inst As New SHDocVw.InternetExplorer
Dim wbrAll As mshtml.IHTMLElementCollection = _
Me.IE_Inst.Document.("input")

[C#]
private SHDocVw.InternetExplorer IE_Inst = new SHDocVw.InternetExplorer();
this.IE_Inst.Document.getElementsByTagName("input" );

What did I miss in C# that VB.NET picked up?

Thanks,
Brett

Nov 17 '05 #3
The method is definitely GetElementsByTagName(string tagName)
What's the exact compiler error message?

Willy.
"Brett" <no@spam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Tried that but it doesn't work either. Any other suggestions?

Thanks,
Brett
"Richard Blewett [DevelopMentor]" <ri******@NOSPAMdevelop.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
C# is casse sentitive - Did you mean to use a capital G at the start of
the method name?

Regards

RIchard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Sorry for all the post on conversion from VB.NET to C#. Just can't
figure
some of these out. getElementsByTagName method is fine in VB but get this
error in C#:

Object does not contain a signature for getElementsByTagName

Intellisense in both langauges is the same.

[VB.NET]
Private WithEvents IE_Inst As New SHDocVw.InternetExplorer
Dim wbrAll As mshtml.IHTMLElementCollection = _
Me.IE_Inst.Document.("input")

[C#]
private SHDocVw.InternetExplorer IE_Inst = new
SHDocVw.InternetExplorer();
this.IE_Inst.Document.getElementsByTagName("input" );

What did I miss in C# that VB.NET picked up?

Thanks,
Brett


Nov 17 '05 #4
If I use capital G, it says object does not contain a definition for ...
Here is the error with lower case G:

C:\myFiles\MailC#\Main\IE.cs(81): 'object' does not contain a definition for
'getElementsByTagName'

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:e3**************@TK2MSFTNGP15.phx.gbl...
The method is definitely GetElementsByTagName(string tagName)
What's the exact compiler error message?

Willy.
"Brett" <no@spam.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Tried that but it doesn't work either. Any other suggestions?

Thanks,
Brett
"Richard Blewett [DevelopMentor]" <ri******@NOSPAMdevelop.com> wrote in
message news:%2****************@TK2MSFTNGP10.phx.gbl...
C# is casse sentitive - Did you mean to use a capital G at the start of
the method name?

Regards

RIchard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

Sorry for all the post on conversion from VB.NET to C#. Just can't
figure
some of these out. getElementsByTagName method is fine in VB but get
this
error in C#:

Object does not contain a signature for getElementsByTagName

Intellisense in both langauges is the same.

[VB.NET]
Private WithEvents IE_Inst As New SHDocVw.InternetExplorer
Dim wbrAll As mshtml.IHTMLElementCollection = _
Me.IE_Inst.Document.("input")

[C#]
private SHDocVw.InternetExplorer IE_Inst = new
SHDocVw.InternetExplorer();
this.IE_Inst.Document.getElementsByTagName("input" );

What did I miss in C# that VB.NET picked up?

Thanks,
Brett



Nov 17 '05 #5

"Brett" <no@spam.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
If I use capital G, it says object does not contain a definition for ...
Here is the error with lower case G:

C:\myFiles\MailC#\Main\IE.cs(81): 'object' does not contain a definition
for 'getElementsByTagName'

Sorry looking in the wrong namespace for getElementsByTagName.
'object' does not contain .. means this.IE_Inst.Document returns an Object
type, VB has better support for this late binding stuff (using reflection),
in C# you have to cast the object to the right Interface like this ...
object o = null;
IEDocvw.InternetExplorer ie = new IEDocvw.InternetExplorer();
IWebBrowserApp wb = ie as IWebBrowserApp;
wb.Navigate("http://xxxxx", ref o, ref o, ref o, ref o);
wb.Visible = false;
HTMLDocument wd = (HTMLDocument)wb.Document;
IHTMLElementCollection ic = wd.getElementsByTagName("input");
Console.WriteLine(ic.length);

Willy.
Nov 17 '05 #6

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...

"Brett" <no@spam.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
If I use capital G, it says object does not contain a definition for ...
Here is the error with lower case G:

C:\myFiles\MailC#\Main\IE.cs(81): 'object' does not contain a definition
for 'getElementsByTagName'

Sorry looking in the wrong namespace for getElementsByTagName.
'object' does not contain .. means this.IE_Inst.Document returns an Object
type, VB has better support for this late binding stuff (using
reflection), in C# you have to cast the object to the right Interface like
this ...
object o = null;
IEDocvw.InternetExplorer ie = new IEDocvw.InternetExplorer();
IWebBrowserApp wb = ie as IWebBrowserApp;
wb.Navigate("http://xxxxx", ref o, ref o, ref o, ref o);
wb.Visible = false;
HTMLDocument wd = (HTMLDocument)wb.Document;
IHTMLElementCollection ic = wd.getElementsByTagName("input");
Console.WriteLine(ic.length);

Willy.


Thanks. It is working now. Nice.

How about this one:

object novar1;
object novar2;
IE_Inst.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER , novar1, novar2);

I think the problem is on those last two arguments. No matter what I use, I
get this error:

The best overloaded method match for
'SHDocVw.IWebBrowser2.ExecWB(SHDocVw.OLECMDID, SHDocVw.OLECMDEXECOPT, ref
object, ref object)' has some invalid arguments

Any ideas?

Brett
Nov 17 '05 #7

"Brett" <no@spam.com> wrote in message
news:O0****************@TK2MSFTNGP09.phx.gbl...

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...

"Brett" <no@spam.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
If I use capital G, it says object does not contain a definition for ...
Here is the error with lower case G:

C:\myFiles\MailC#\Main\IE.cs(81): 'object' does not contain a definition
for 'getElementsByTagName'

Sorry looking in the wrong namespace for getElementsByTagName.
'object' does not contain .. means this.IE_Inst.Document returns an
Object type, VB has better support for this late binding stuff (using
reflection), in C# you have to cast the object to the right Interface
like this ...
object o = null;
IEDocvw.InternetExplorer ie = new IEDocvw.InternetExplorer();
IWebBrowserApp wb = ie as IWebBrowserApp;
wb.Navigate("http://xxxxx", ref o, ref o, ref o, ref o);
wb.Visible = false;
HTMLDocument wd = (HTMLDocument)wb.Document;
IHTMLElementCollection ic = wd.getElementsByTagName("input");
Console.WriteLine(ic.length);

Willy.


Thanks. It is working now. Nice.

How about this one:

object novar1;
object novar2;
IE_Inst.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER , novar1, novar2);

I think the problem is on those last two arguments. No matter what I use,
I get this error:

The best overloaded method match for
'SHDocVw.IWebBrowser2.ExecWB(SHDocVw.OLECMDID, SHDocVw.OLECMDEXECOPT, ref
object, ref object)' has some invalid arguments

Any ideas?

Brett


Check your error message, you need to pass a reference.
..... ref object, ref object)

Willy.


Nov 17 '05 #8

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...

"Brett" <no@spam.com> wrote in message
news:O0****************@TK2MSFTNGP09.phx.gbl...

"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:O0**************@tk2msftngp13.phx.gbl...

"Brett" <no@spam.com> wrote in message
news:uV**************@TK2MSFTNGP09.phx.gbl...
If I use capital G, it says object does not contain a definition for
... Here is the error with lower case G:

C:\myFiles\MailC#\Main\IE.cs(81): 'object' does not contain a
definition for 'getElementsByTagName'

Sorry looking in the wrong namespace for getElementsByTagName.
'object' does not contain .. means this.IE_Inst.Document returns an
Object type, VB has better support for this late binding stuff (using
reflection), in C# you have to cast the object to the right Interface
like this ...
object o = null;
IEDocvw.InternetExplorer ie = new IEDocvw.InternetExplorer();
IWebBrowserApp wb = ie as IWebBrowserApp;
wb.Navigate("http://xxxxx", ref o, ref o, ref o, ref o);
wb.Visible = false;
HTMLDocument wd = (HTMLDocument)wb.Document;
IHTMLElementCollection ic = wd.getElementsByTagName("input");
Console.WriteLine(ic.length);

Willy.


Thanks. It is working now. Nice.

How about this one:

object novar1;
object novar2;
IE_Inst.ExecWB(SHDocVw.OLECMDID.OLECMDID_PRINT,
SHDocVw.OLECMDEXECOPT.OLECMDEXECOPT_DONTPROMPTUSER , novar1, novar2);

I think the problem is on those last two arguments. No matter what I
use, I get this error:

The best overloaded method match for
'SHDocVw.IWebBrowser2.ExecWB(SHDocVw.OLECMDID, SHDocVw.OLECMDEXECOPT, ref
object, ref object)' has some invalid arguments

Any ideas?

Brett


Check your error message, you need to pass a reference.
.... ref object, ref object)

Willy.


Very cool Willy. Error went away. I am still passing in empty objects:
object novar1;
object novar2;

Is there a better way or is this acceptable?

Here's one more that I'm having trouble with. Again, a VB.NET to C#
conversion:
[VB.NET]
Dim UDCPrinter As New UDCWRAPPERLib.Printer
Dim UDCProfile As UDCWRAPPERLib.Profile

UDCPrinter.PrinterName = "Universal Document Converter"
UDCProfile = UDCPrinter.Profile(UDCPrinter.DefaultProfile)

[C#}
UDCWRAPPERLib.Printer UDCPrinter = new UDCWRAPPERLib.Printer();
UDCWRAPPERLib.Profile UDCProfile;

UDCPrinter.PrinterName = "Universal Document Converter";
UDCProfile = UDCPrinter.get_Profile();

Error is on the last line:
No overload for method 'get_Profile' takes '0' arguments

Object browser tree looks like this:
UDCWRAPPERLib
Printer (interface)
IPrinter (interface)

get_Profile(string) is a member of the last node.

I'm using get_Profile because .Profile isn't available in C#. Why does the
above error occur is "string" type is required?

I have tried:
UDCProfile = UDCPrinter.get_Profile(UDCPrinter.DefaultProfile);
and get:
Cannot implicitly convert type 'object' to 'UDCWRAPPERLib.Profile'

Any suggestions?

Thanks,
Brett

Nov 17 '05 #9

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

Similar topics

0
by: Tim Richardson | last post by:
I am attempting to copy some files from one machine to another. I am having difficulty with the File.Exists() in the code below. The program enumerates the files in a directory, checks them...
2
by: Jon Davis | last post by:
The garbage handler in the .NET framework is handy. When objects fall out of scope, they are automatically destroyed, and the programmer doesn't have to worry about deallocating the memory space...
3
by: Sean Tynan | last post by:
I want to find out the best way for a method to notify calling code of situations such as validation errors, etc. that may occur during method execution. e.g. say I have a method (business...
6
by: Teresa | last post by:
1) If I do want to keep an object alive throughout the live of an application, how can I ensure that the GC doesn't clean it up? 2a) How do I determine if an object is a managed or an unmanged...
1
by: BobAchgill | last post by:
Is there a special method to find out if a folder exists? The File.exists method for some reason did not work for me to see a folder. So I thought maybe there is another way to see if a folder...
2
by: sianan | last post by:
I am having a problem doing the following in generics. I have two list of a custom item type. I need to iterate through the first list and match each item against another list to see if there is...
2
by: Tarscher | last post by:
Hi all, I have a list of integers and simply want to check if a number exists in that list. In the manual I found the List.Exists method but this apparently only works for constants values via a...
2
by: Tim | last post by:
Dim Animals as String() = {"cat", "dog", "mouse", "rat"} Can the Exists or Find method be used to determine if the Animals array contains "mouse" ? If Animals.Exists(.... or ...
7
by: Jeff | last post by:
I need a way to do the following and cannot seem to find a solution via google. 1. Have a method from the main app to get all open forms 2. Check each open form for a public method 3. If this...
2
by: cloudy | last post by:
First at all, i'm sorry, i not good in writing english. i want to retrieve a string from my applet via Javascript. I use a method named ReadAll. public String ReadAll(String StrOut, String...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.