Dear newsgroup - do not reply to this e-mail address. I have just
created it to avoid getting spam to my real address. Reply to the
newsgroup. I am watching them all now so please reply now.
How do I get a list of methods that my class supports? Here is my
code.
I want
MsgBox(a.GetMethods, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly,
a.GetVersion)
to display, if a is a "TanOperations", "getTan1, getTan2". If a is a
"SinOperations", "getSin" etc.
To help you I am using Visual Studio .net 2003.
Thank you
Gladys
Imports System.Math
Public Class Form1
Inherits System.Windows.Forms.Form
Private MustInherit Class Trigonometry
Public Shared Function GetVersion() As String
Return "V1.0.1"
End Function
Public Function GetMethods() As String()
'WHAT CODE GOES IN HERE??
'=========================
End Function
End Class
Private Class TanOperations
Inherits Trigonometry
Public Function getTan1(ByVal opp As Double, ByVal adj As
Double) As Double
Return Tan(opp / adj)
End Function
Public Function getTan2(ByVal theta As Double) As Double
Return Tan(theta)
End Function
End Class
Private Class SinOperations
Inherits Trigonometry
Public Function getSin(ByVal opp As Double, ByVal hypot As
Double) As Double
Return Sin(opp / hypot)
End Function
End Class
'windows form designer code deleted to save posting space
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e
As System.EventArgs) Handles Button1.Click
Dim a As New TanOperations
MsgBox(a.getTan(10, 20), MsgBoxStyle.Information Or
MsgBoxStyle.OKOnly, a.GetVersion)
MsgBox(a.GetMethods, MsgBoxStyle.Information Or
MsgBoxStyle.OKOnly, a.GetVersion)
End Sub
End Class 3 1322
You can use reflection:
Dim t As Type = GetType(MyClass)
For Each methodInfo As System.Reflection.MethodInfo _
In t.GetMethods
MsgBox(methodInfo.Name)
Next
--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Gladys" <gl***********@hotmail.com> schreef in bericht
news:67**************************@posting.google.c om... Dear newsgroup - do not reply to this e-mail address. I have just created it to avoid getting spam to my real address. Reply to the newsgroup. I am watching them all now so please reply now.
How do I get a list of methods that my class supports? Here is my code. I want
MsgBox(a.GetMethods, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly, a.GetVersion)
to display, if a is a "TanOperations", "getTan1, getTan2". If a is a "SinOperations", "getSin" etc.
To help you I am using Visual Studio .net 2003.
Thank you Gladys Imports System.Math
Public Class Form1 Inherits System.Windows.Forms.Form
Private MustInherit Class Trigonometry Public Shared Function GetVersion() As String Return "V1.0.1" End Function
Public Function GetMethods() As String() 'WHAT CODE GOES IN HERE?? '=========================
End Function End Class
Private Class TanOperations Inherits Trigonometry Public Function getTan1(ByVal opp As Double, ByVal adj As Double) As Double Return Tan(opp / adj) End Function
Public Function getTan2(ByVal theta As Double) As Double Return Tan(theta) End Function End Class
Private Class SinOperations Inherits Trigonometry Public Function getSin(ByVal opp As Double, ByVal hypot As Double) As Double Return Sin(opp / hypot) End Function End Class
'windows form designer code deleted to save posting space
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a As New TanOperations MsgBox(a.getTan(10, 20), MsgBoxStyle.Information Or MsgBoxStyle.OKOnly, a.GetVersion) MsgBox(a.GetMethods, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly, a.GetVersion) End Sub End Class
Jan's method is very good. As an FYI, you can also use GetMembers and get
additional information about properties events etc. http://www.knowdotnet.com/articles/reflection.html
"Gladys" <gl***********@hotmail.com> wrote in message
news:67**************************@posting.google.c om... Dear newsgroup - do not reply to this e-mail address. I have just created it to avoid getting spam to my real address. Reply to the newsgroup. I am watching them all now so please reply now.
How do I get a list of methods that my class supports? Here is my code. I want
MsgBox(a.GetMethods, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly, a.GetVersion)
to display, if a is a "TanOperations", "getTan1, getTan2". If a is a "SinOperations", "getSin" etc.
To help you I am using Visual Studio .net 2003.
Thank you Gladys Imports System.Math
Public Class Form1 Inherits System.Windows.Forms.Form
Private MustInherit Class Trigonometry Public Shared Function GetVersion() As String Return "V1.0.1" End Function
Public Function GetMethods() As String() 'WHAT CODE GOES IN HERE?? '=========================
End Function End Class
Private Class TanOperations Inherits Trigonometry Public Function getTan1(ByVal opp As Double, ByVal adj As Double) As Double Return Tan(opp / adj) End Function
Public Function getTan2(ByVal theta As Double) As Double Return Tan(theta) End Function End Class
Private Class SinOperations Inherits Trigonometry Public Function getSin(ByVal opp As Double, ByVal hypot As Double) As Double Return Sin(opp / hypot) End Function End Class
'windows form designer code deleted to save posting space
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim a As New TanOperations MsgBox(a.getTan(10, 20), MsgBoxStyle.Information Or MsgBoxStyle.OKOnly, a.GetVersion) MsgBox(a.GetMethods, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly, a.GetVersion) End Sub End Class
* gl***********@hotmail.com (Gladys) scripsit:
[...]
Are you sure you understood the meaning of the "Subject:" line?
--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: chausan |
last post by:
Update
++++++
All attchment scanned with norton anti-virus w/ yahoo mail service and
they all reported infected with virus Worm.Automat.AHB.
========================================
From:...
|
by: Fabrizio |
last post by:
HI,
How i can use the Microsoft.Web.UI.WebControls reference
inside a web project?
There is any DLL to add?
Thank you,
Fabrizio
|
by: Michael Adams |
last post by:
I don't know if you have noticed, but it seems like Microsoft is losing
interest in C#, and putting their energy into Visual Basic.NET instead.
For instance, online chats by language since July...
|
by: Jim Hubbard |
last post by:
http://www.eweek.com/article2/0,1759,1774642,00.asp
|
by: Mark |
last post by:
Hello
I am trying to set up an open file routine that will open whatever files
name is passed with its correct associated application. I have done this
(quite easilly) before in VBA and am able...
|
by: Tay Kai Yang |
last post by:
Hi
Sincerely wanting to know how to subscribe to
microsoft.public.dotnet.language.csharp. I have contacted my ISP
regarding the problem that I cannot access...
|
by: kavsak |
last post by:
Hi. Not sure that this is the right place to ask but here goes.
I have an application based on access97 and VB6 which I need to
upgrade. It has to handle up to 20 concurrent users on a Win2k...
|
by: =?Utf-8?B?TWlrZTE5NDI=?= |
last post by:
This is an example that is supposed to work in VB
http://support.microsoft.com/kb/175512/en-us
After spending a couple of hours downloading and installing VB Express 2008
after someone told me it...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
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...
|
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...
|
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
|
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,...
|
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,...
|
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...
| | |