473,503 Members | 1,748 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 12599
Hi,

It is under overrides.

Ken
-------------------
"Surrealist" <Su********@discussions.microsoft.com> wrote in message
news:2C**********************************@microsof t.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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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********@discussions.microsoft.com> wrote in message
news:2D**********************************@microsof t.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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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.ToString 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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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.ToString 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********@discussions.microsoft.com> wrote in message
news:2D**********************************@microsof t.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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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.ToString 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********@discussions.microsoft.com> wrote in message
news:2D**********************************@microsof t.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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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.ToString 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?U3VycmVhbGlzdA==?=" <Su********@discussions.microsoft.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
3148
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...
5
1834
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. ...
2
1537
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:...
2
1326
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...
0
1467
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...
4
4217
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...
7
5094
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...
9
1826
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...
40
2285
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...
6
6436
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:...
0
7258
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
7313
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...
1
6970
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
5558
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,...
1
4987
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...
0
4663
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...
0
3146
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1489
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 ...
1
720
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.