473,654 Members | 3,104 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to create an overrides Sub or Function in VB.NET IDE?

I need something likes as when I create an event procedure.
I can use top-left and top-right dropdown list of code editor
to select object and its exposed events respectively.

Then, the IDE, automatically paste the function
header (signature) for me.

But I can't find a way to see list of Sub or Function
that I can overrides such as ToString Function.

Please guide me.
TIA.
Nov 20 '05 #1
9 12610
Hi,

It is under overrides.

Ken
-------------------
"Surrealist " <Su********@dis cussions.micros oft.com> wrote in message
news:2C******** *************** ***********@mic rosoft.com...
I need something likes as when I create an event procedure.
I can use top-left and top-right dropdown list of code editor
to select object and its exposed events respectively.

Then, the IDE, automatically paste the function
header (signature) for me.

But I can't find a way to see list of Sub or Function
that I can overrides such as ToString Function.

Please guide me.
TIA.

Nov 20 '05 #2
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit:
I need something likes as when I create an event procedure.
I can use top-left and top-right dropdown list of code editor
to select object and its exposed events respectively.

Then, the IDE, automatically paste the function
header (signature) for me.

But I can't find a way to see list of Sub or Function
that I can overrides such as ToString Function.


Select "(Overrides )" in the left combobox, and then the method you want
to override in the right combobox (works for 'ToString').

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #3
It's work fine for a Form.

But how about if I create my own class?
It's not has (Overrides) for me.

Thanks.
Surrealist.
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit:
I need something likes as when I create an event procedure.
I can use top-left and top-right dropdown list of code editor
to select object and its exposed events respectively.

Then, the IDE, automatically paste the function
header (signature) for me.

But I can't find a way to see list of Sub or Function
that I can overrides such as ToString Function.


Select "(Overrides )" in the left combobox, and then the method you want
to override in the right combobox (works for 'ToString').

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #4
"Surrealist " <Su********@dis cussions.micros oft.com> wrote in message
news:2D******** *************** ***********@mic rosoft.com...
It's work fine for a Form.

But how about if I create my own class?
It's not has (Overrides) for me.
I suspect you only see an Overrides section when there's something
to override. You need to declare the methods in your Base class as
Overridable, as in

[Base1.vb]
Public Class Base1
Public Overridable Sub Pop()
. . .
End Sub
End Class

[Derived1.vb]
Public Class Derived1
Inherits Base1

Public Overrides Sub Pop()
. . .
End Sub

End Class

HTH,
Phill W.

Thanks.
Surrealist.
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit:
I need something likes as when I create an event procedure.
I can use top-left and top-right dropdown list of code editor
to select object and its exposed events respectively.

Then, the IDE, automatically paste the function
header (signature) for me.

But I can't find a way to see list of Sub or Function
that I can overrides such as ToString Function.


Select "(Overrides )" in the left combobox, and then the method you want
to override in the right combobox (works for 'ToString').

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #5
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit:
It's work fine for a Form.

But how about if I create my own class?
It's not has (Overrides) for me.


Mark the methods as 'Overridable'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #6
Thanks for all that participate in solving my problem.

I still have a question that did not solved.
I'll list my understanding and please let me know if somethings incorrect.

- Every class must has a based class and its root must be System.Object.
- In System.Object has ToString method that overridable.
- So, If I declare a class without Inherits clause.
Does it inherits from System.Object by default? Why it does not show
(Overrides) section in "Class Name" dropdown list.

Public Class Person
Public FirstName, LastName As String

' ---- How can I create an overrides function of System.Object.T oString here,
' ---- with helpping from Visual Studio .Net IDE?

' ---- Which I currently know is _manually_ type the function header
' ---- with a correct signature as this:
Public Overrides Function ToString() As String
Return FirstName & " " & LastName
End Function

End Class
Thank again,
Surrealist.
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit:
It's work fine for a Form.

But how about if I create my own class?
It's not has (Overrides) for me.


Mark the methods as 'Overridable'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #7
Thanks for all that participate in solving my problem.

I still have a question that did not solved.
I'll list my understanding and please let me know if somethings incorrect.

- Every class must has a based class and its root must be System.Object.
- In System.Object has ToString method that overridable.
- So, If I declare a class without Inherits clause.
Does it inherits from System.Object by default? Why it does not show
(Overrides) section in "Class Name" dropdown list.

Public Class Person
Public FirstName, LastName As String

' ---- How can I create an overrides function of System.Object.T oString here,
' ---- with helpping from Visual Studio .Net IDE?

' ---- Which I currently know is _manually_ type the function header
' ---- with a correct signature as this:
Public Overrides Function ToString() As String
Return FirstName & " " & LastName
End Function

End Class
Thank again,
Surrealist.

"Phill. W" wrote:
"Surrealist " <Su********@dis cussions.micros oft.com> wrote in message
news:2D******** *************** ***********@mic rosoft.com...
It's work fine for a Form.

But how about if I create my own class?
It's not has (Overrides) for me.


I suspect you only see an Overrides section when there's something
to override. You need to declare the methods in your Base class as
Overridable, as in

[Base1.vb]
Public Class Base1
Public Overridable Sub Pop()
. . .
End Sub
End Class

[Derived1.vb]
Public Class Derived1
Inherits Base1

Public Overrides Sub Pop()
. . .
End Sub

End Class

HTH,
Phill W.

Thanks.
Surrealist.
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit: > I need something likes as when I create an event procedure.
> I can use top-left and top-right dropdown list of code editor
> to select object and its exposed events respectively.
>
> Then, the IDE, automatically paste the function
> header (signature) for me.
>
> But I can't find a way to see list of Sub or Function
> that I can overrides such as ToString Function.

Select "(Overrides )" in the left combobox, and then the method you want
to override in the right combobox (works for 'ToString').

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 20 '05 #8
Thanks for all that participate in solving my problem.

I still have a question that did not solved.
I'll list my understanding and please let me know if somethings incorrect.

- Every class must has a based class and its root must be System.Object.
- In System.Object has ToString method that overridable.
- So, If I declare a class without Inherits clause.
Does it inherits from System.Object by default? Why it does not show
(Overrides) section in "Class Name" dropdown list.

Public Class Person
Public FirstName, LastName As String

' ---- How can I create an overrides function of System.Object.T oString here,
' ---- with helpping from Visual Studio .Net IDE?

' ---- Which I currently know is _manually_ type the function header
' ---- with a correct signature as this:
Public Overrides Function ToString() As String
Return FirstName & " " & LastName
End Function

End Class
Thank again,
Surrealist.

"Phill. W" wrote:
"Surrealist " <Su********@dis cussions.micros oft.com> wrote in message
news:2D******** *************** ***********@mic rosoft.com...
It's work fine for a Form.

But how about if I create my own class?
It's not has (Overrides) for me.


I suspect you only see an Overrides section when there's something
to override. You need to declare the methods in your Base class as
Overridable, as in

[Base1.vb]
Public Class Base1
Public Overridable Sub Pop()
. . .
End Sub
End Class

[Derived1.vb]
Public Class Derived1
Inherits Base1

Public Overrides Sub Pop()
. . .
End Sub

End Class

HTH,
Phill W.

Thanks.
Surrealist.
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit: > I need something likes as when I create an event procedure.
> I can use top-left and top-right dropdown list of code editor
> to select object and its exposed events respectively.
>
> Then, the IDE, automatically paste the function
> header (signature) for me.
>
> But I can't find a way to see list of Sub or Function
> that I can overrides such as ToString Function.

Select "(Overrides )" in the left combobox, and then the method you want
to override in the right combobox (works for 'ToString').

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>


Nov 20 '05 #9
Once you declare the new class, and do not explicatly inherit from System.Object, then the Overridable function of System.Object is hidden. Not sure if it is an IDE thing or a Framework thing.

I do know that you can write your own ToString function without marking it as Overrides, so I would tend to think that it is a Framework thing. I suspect that if you do not explicately inherit from System.Object that there is code to implecitely shadow the ToString, Equals and GetHashCode functions if you specify them otherwise provide the default implementation.

HTH
--
David Williams, VB.NET MVP
"Surrealist " wrote:
Thanks for all that participate in solving my problem.

I still have a question that did not solved.
I'll list my understanding and please let me know if somethings incorrect.

- Every class must has a based class and its root must be System.Object.
- In System.Object has ToString method that overridable.
- So, If I declare a class without Inherits clause.
Does it inherits from System.Object by default? Why it does not show
(Overrides) section in "Class Name" dropdown list.

Public Class Person
Public FirstName, LastName As String

' ---- How can I create an overrides function of System.Object.T oString here,
' ---- with helpping from Visual Studio .Net IDE?

' ---- Which I currently know is _manually_ type the function header
' ---- with a correct signature as this:
Public Overrides Function ToString() As String
Return FirstName & " " & LastName
End Function

End Class
Thank again,
Surrealist.
"Herfried K. Wagner [MVP]" wrote:
* "=?Utf-8?B?U3VycmVhbGl zdA==?=" <Su********@dis cussions.micros oft.com> scripsit:
It's work fine for a Form.

But how about if I create my own class?
It's not has (Overrides) for me.


Mark the methods as 'Overridable'.

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Nov 20 '05 #10

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

Similar topics

0
3160
by: Petri Savolainen | last post by:
After reading the manuals and googling around a bit, I thought I'd use the 'compile' built-in to create a code object. Then, using either new.function() or types.FunctionType(), create a function object out of the code object. The function object can then be turned into a method for example using types.MethodType(). Right? Well, on Windows 98, using python 2.2.2 (or 2.3b2): >>> c=compile('def a(msg): return msg','<nowhere>','exec') >>>...
5
1846
by: Try Kret | last post by:
Hello ! I was wondering how to create a function that can be applied to all type of variables? If we use for example, sortList(void *obj), we can not do the comparison of 2 strcut. Faithfully yours, Try Kret.
2
1540
by: siliconpiNOSPAM | last post by:
Hi, I'm new to C# programming and not sure how to do this, but basically, I want to create a function exactly like how System.Console.WriteLine() works. eg, if I do: System.Console.WriteLine("A = " + valA + " B = " + valB); it displays all of the above together.
2
1339
by: Microsoft | last post by:
Hi; I want to create a function point.With is point I can call the member function in a class. The Sample Code just like: __gc struct NodeMapItem { String *NodeID; void (*FuncPnt)(reportNode *); };
0
1470
by: Andreas Klemt | last post by:
Hello, I have this Protected Overrides Function OnBubbleEvent(ByVal source As Object, ByVal args As System.EventArgs) As Boolean a) Return True b) Return False c) Doing nothing... End Function
4
4225
by: Tamer via DotNetMonster.com | last post by:
I'm developing a graphic engine. I got all equations made, I need only to understand how I can create a function that, once accepted three values (x; y; z), it returns the two values (X; Y) coming from two distinct mathematical processes. I don't want to use another global variable, I'm trying to be fast, in order to use such a function even in this way: Public Structure Point x as double y as double z as double
7
5112
by: Jimakos Bilakis | last post by:
Hi guys! I'm using the C++ Builder 6 Enterprise Edition where I create some tables in Paradox and with the help of a structure i pass my data from the form (Edit boxes) to the Paradox table with a speedbutton. (I am also using several data modules where i keep all my tables and queries). First of all i need some "mechanism" to read the data from the tables and also to be able to change these already stored values. I tried with
9
1829
by: Jimakos Bilakis | last post by:
Hi everyone! I want to create a function that it will take as parameters a table (float), an integer (the number of Table's rows) and it will re-arrange the elements in the table from the smallest value to the biggest one. I know it's very simple but something is missing from my code... Untill now i manage to create something like this: 1. void FunctionReArrange (float Table, int TableRows) 2. {
40
2334
by: Angus | last post by:
Hello I am writing a library which will write data to a user defined callback function. The function the user of my library will supply is: int (*callbackfunction)(const char*); In my libary do I create a function where user passes this callback function? How would I define the function?
6
6447
oulan
by: oulan | last post by:
I want to create a function like IIF in Microsoft Access. But SQL Server 2000 do not have boolean data type. Someone told me bit could be alternative. The question is, if I define function like: create function IIF(@boolexp bit, @tv sql_variant, @fv sql_variant) ... I could SELECT IIF(COLNAME*3, 'T', 'F') FROM TABLENAME but could not use
0
8379
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8294
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
8494
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7309
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5627
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4297
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2719
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1924
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.