Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. calling myclass subs

calling myclass subs

Scheduled Pinned Locked Moved Visual Basic
csharphelp
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Anonymous
    wrote on last edited by
    #1

    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.vb Public 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.

    D 1 Reply Last reply
    0
    • A Anonymous

      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.vb Public 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.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      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 Class

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

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups