Help please

  • Thread starter Thread starter Gladys
  • Start date Start date
G

Gladys

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
 
Gladys,

Point 1:
=============
What you are after is in the on-line help for VS 2003. Read it. Here is the
reference to get you started and includes a sample application.

ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.1033/cpref/html/frlrfSystemTypeCla
ssGetMethodsTopic.htm

Point 2:
=============
As you have written the following

MsgBox(a.GetMethods, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly,
a.GetVersion)

it gives the developer the distinct impression that "GetVersion" is a
property of the instance of the class. It isn't, it is a property of the
class and doesn't require an instance to even be created. Your code could
(and IMHO should) read

MsgBox(a.GetMethods, MsgBoxStyle.Information Or MsgBoxStyle.OKOnly,
TanOperations.GetVersion)

Point 3:
=============
Don't cross post like this. You posted to all of

microsoft.public.dotnet.languages.vb.data
microsoft.public.dotnet.languages.vb.controls
microsoft.public.dotnet.languages.vb,
microsoft.public.dotnet.languages.vb.upgrade

Think about the intended audience for your posting. Post to limited and
appropriate newsgroup(s) only. And lastly a comment on tone. I doubt very
much that comments like "I am watching them all now so please reply now."
is going to endear you to many people.

Hexathioorthooxalate
 
1) Very well stated...
2) How do you say this "Hexathioorthooxalate"

I have
Hex-a'-thio-ortho-oxa-late...

Could you use it in a sentance? =)
 
CJ Taylor said:
1) Very well stated...
2) How do you say this "Hexathioorthooxalate"

I have
Hex-a'-thio-ortho-oxa-late...

Could you use it in a sentance? =)

Or better yet, can you smoke it? ;-D
 
* (e-mail address removed) (Gladys) scripsit:
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.

Have a look at:

'System.Reflection' namespace.
'Object.GetType' method.
'Type.Get<...>' methods.
 
Back
Top