calling myclass subs
-
I created the class called myClass as following in vb.net
public Class myClass Public Function add(num1 As Integer, num2 As Integer) Dim result As Integer result = (num1+num2) set add=result End Function End class
I saved it as myClass.vb And I go back to the form1.vbPublic Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Dim pf As New myClass pf.PrintWord("c:\pckm\101.doc/name_/format_autodate/autodate_/end_") End Class
but I have error C:\DotNetProgs\myProg\myProg\Form1.vb(60) : error BC30188: Declaration expected. -
I created the class called myClass as following in vb.net
public Class myClass Public Function add(num1 As Integer, num2 As Integer) Dim result As Integer result = (num1+num2) set add=result End Function End class
I saved it as myClass.vb And I go back to the form1.vbPublic Class Form1 Inherits System.Windows.Forms.Form #Region " Windows Form Designer generated code " Dim pf As New myClass pf.PrintWord("c:\pckm\101.doc/name_/format_autodate/autodate_/end_") End Class
but I have error C:\DotNetProgs\myProg\myProg\Form1.vb(60) : error BC30188: Declaration expected.First, your myClass doesn't have a PrintWord method, unless there is extra code in there your not showing us. Also, from the code you have shown us, myClass is a keyword and can't be used as the name of a class. Plus, your class can be greatly simplified like this:
Public Class testClass
Public Function add(ByVal num1 As Integer, ByVal num2 As Integer) As Integer
Return num1 + num2
End Function
End ClassSecond, we need to see line 60 of Form1.vb and the code surrounding it to be able to tell you what is going on. RageInTheMachine9532