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 1324
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: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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...
|
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...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
|
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...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The...
| | |