473,395 Members | 2,446 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,395 software developers and data experts.

Extends in C# or VB.NET?

In java, you can do:

public class MyJButton extends JButton{
public MyJButton(){
}
}

then you can use this custom button as if it was a JButton...

Applet.add(new MyJButton());
same as
Applet.add(new JButton());

is it possible in C# or VB.net?

Question 2:

In vb.net i can do:

Dim ohttp As Object = Server.CreateObject("MSXML2.ServerXMLHTTP")
ohttp.Open ("GET","http://www.google.ca",false)
ohttp.Send()

But in C#, it says that Generic Object does not have 'Open' method?
what can i use?

Sep 25 '05 #1
2 19366
In C#:
public class MyJButton: JButton
In VB:
Public Class MyJButton
Inherits JButton
--
David Anton
www.tangiblesoftwaresolutions.com
Instant C#: VB.NET to C# Converter
Instant VB: C# to VB.NET Converter
Instant J#: VB.NET to J# Converter
Clear VB: Cleans up outdated VB.NET code
"tascien" wrote:
In java, you can do:

public class MyJButton extends JButton{
public MyJButton(){
}
}

then you can use this custom button as if it was a JButton...

Applet.add(new MyJButton());
same as
Applet.add(new JButton());

is it possible in C# or VB.net?

Question 2:

In vb.net i can do:

Dim ohttp As Object = Server.CreateObject("MSXML2.ServerXMLHTTP")
ohttp.Open ("GET","http://www.google.ca",false)
ohttp.Send()

But in C#, it says that Generic Object does not have 'Open' method?
what can i use?

Sep 25 '05 #2
In answer to question 2:

C# doesn't accept (I think it's called) late binding. So the object you
declare must expose the methods you want. I'm not familiar with
ServerXMLHTTP, but you'd have to do something like:

Object ohttp = Server.CreateObject("MSXML2.ServerXMLHTTP");
ServerXMLHTTP http = (ServerXMLHTTP)ohttp; // explicit cast
http.Send();
....

See also
help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/dnaspp/html/aspnetmigrissues.htm,
which has this specific example under the heading "OnStartPage and OnEndPage
Methods", about half way down the page. (Note: that this link will only work
if you have the documentation on your machine. Maybe someone has the actual
URL at microsoft?)

"tascien" <ta******@ecoaches.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
In java, you can do:

public class MyJButton extends JButton{
public MyJButton(){
}
}

then you can use this custom button as if it was a JButton...

Applet.add(new MyJButton());
same as
Applet.add(new JButton());

is it possible in C# or VB.net?

Question 2:

In vb.net i can do:

Dim ohttp As Object = Server.CreateObject("MSXML2.ServerXMLHTTP")
ohttp.Open ("GET","http://www.google.ca",false)
ohttp.Send()

But in C#, it says that Generic Object does not have 'Open' method?
what can i use?

Sep 26 '05 #3

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

Similar topics

4
by: Phil Powell | last post by:
class Parent { var $errorArray = array(); function Parent() { return true; } function getErrorArray() { return $this->errorArray; }
3
by: Hal Vaughan | last post by:
I'm creating a sequence of JPanels that will each, in turn, be added to (then removed from) a window (kind of like a wizard). I want these panels to not only extend the JPanel class, but to...
5
by: Mark & Candice White | last post by:
Is there a way to take an existing simple type like double and extend it? I would like to add a few methods without reimplementing all the rest as calls to a composed one. public class doubleR...
0
by: Stacey | last post by:
I hate to start the email with the "I'm new to this clause", but there it is. I am understanding how the xsd files work and how the castor SourceGenerator works. What I am not understanding is...
1
by: Tony Johansson | last post by:
Hello experts! As this program is now it's works perfectly when running as a application or as an Applet. Now to my question if I just change this row "public class Converter extends Applet "...
1
by: iLL | last post by:
In java you can say something like: public class child extends parent { } And child will have all of the parent’s functions. From there you can write new functions and overload parent...
4
by: sandyw | last post by:
I need a little help here with extends. I have three class 1. EventsClass 2. TicketClass I have the extends to EventsClass 3. BuyerClass. I have the extends to EventsClass All three class...
6
by: joxonvdavis | last post by:
I have a topic to discuss.. how can i access a implemeted method of an abstract class if my class exteds that abstract class's sub class? Eg: abstract class A { abstract...
0
by: hockeydave007 | last post by:
I am using jaxb to create my java class and I would like the created class to have additional attributes like: extends java.io.Serializable implements my.com.Interface <xs:complexType...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.