title: calling function in class file using vb.net
body: <p>My database access methods are in class file. This file is has a separate project name: <code>Usr_mysqladapter</code>. In another website project I import the class file as a dll and call the function in the class file by creating an object.</p>
  
  <p>The class file contains the following function:</p>
  
  <pre class="lang-vb prettyprint-override"><code>Public Function readfunctioid(ByVal query As String) As DataTable
      Try
          connecttodb()
          mysqlcmd = New MySqlCommand(query, con)
          da = New MySqlDataAdapter(mysqlcmd)
          dt = New DataTable
          da.Fill(dt)
      Catch ex As Exception
          Throw ex
      Finally
          disconnect()
      End Try
      Return dt
  End Function
  </code></pre>
  
  <p>The website projects imports the dll as follows:</p>
  
  <pre><code>  Imports Usr_mysqladapter
  
    Dim obj As Usr_mysqladapter.Class1 = New Usr_mysqladapter.Class1
  </code></pre>
  
  <p>My button click calls the function like this:</p>
  
  <pre><code>dt = obj.readfunctioid("select fld_functionid  from tbl_users_function_permission")
  </code></pre>
  
  <p>Unfortunately, I am getting error. How do I access the function in the class file from my website project?</p>