hi all , i now working on new project that have a class for table includes the add , delete , and update function 
how i can call them in vb??? 

this one of the class 
 Imports System.Data
    Imports System.Data.SqlClient
    Public Class BOQSectionsAndParts

   Private _BOQSectionsAndParts_ID as Integer = 0
   Private _ProjectTenderingNO as String = ""
   Private _BOQSection as String = ""
   Private _Part as String = ""

   Public Property BOQSectionsAndParts_ID() As Integer
       Get
           Return Me._BOQSectionsAndParts_ID
       End Get
       Set(ByVal value As Integer)
           Me._BOQSectionsAndParts_ID= value
       End Set
   End Property

   Public Property ProjectTenderingNO() As String
       Get
           Return Me._ProjectTenderingNO
       End Get
       Set(ByVal value As String)
           Me._ProjectTenderingNO= value
       End Set
   End Property

   Public Property BOQSection() As String
       Get
           Return Me._BOQSection
       End Get
       Set(ByVal value As String)
           Me._BOQSection= value
       End Set
   End Property

   Public Property Part() As String
       Get
           Return Me._Part
       End Get
       Set(ByVal value As String)
           Me._Part= value
       End Set
   End Property
             Private conn As Sqlconnection
             Private _Msg As String = ""
     Public ReadOnly Property Msg() As String
         Get
             Return Me._Msg
         End Get
     End Property


    Private Sub Getconnection()
        Try
            Dim DbConnection As String = System.Configuration.ConfigurationManager.ConnectionStrings("Tendering_System").ConnectionString
            Me.conn = New SqlConnection(DbConnection)
            Me.conn.Open()
        Catch ex As Exception
            Me._Msg = "We can not establish a connection to the database"
        End Try
    End Sub


   Public Sub add()
   Getconnection()
           Dim sql As String = "INSERT INTO BOQSectionsAndParts (ProjectTenderingNO, BOQSection, Part) VALUES(@ProjectTenderingNO, @BOQSection, @Part)"
           Dim Cmd As New SqlCommand(sql, Me.conn)
           Cmd.Parameters.Add("@ProjectTenderingNO", SqlDbType.nvarchar).Value = _ProjectTenderingNO
           Cmd.Parameters.Add("@BOQSection", SqlDbType.nvarchar).Value = _BOQSection
           Cmd.Parameters.Add("@Part", SqlDbType.nvarchar).Value = _Part
       Try
           Cmd.ExecuteNonQuery()
       Catch ex As SQLException
           Me._Msg="Error Message"
       Finally
           Try
               Me.conn.Close()
           Catch
           End Try
       End Try
   End Sub


   Public Sub update()
   Getconnection()
           Dim sql As String = "UPDATE BOQSectionsAndParts Set ProjectTenderingNO= @ProjectTenderingNO, BOQSection= @BOQSection, Part= @Part Where BOQSectionsAndParts_ID = @BOQSectionsAndParts_ID"
           Dim Cmd As New SqlCommand(sql, Me.conn)
           Cmd.Parameters.Add("@BOQSectionsAndParts_ID", SqlDbType.int).Value = _BOQSectionsAndParts_ID
           Cmd.Parameters.Add("@ProjectTenderingNO", SqlDbType.nvarchar).Value = _ProjectTenderingNO
           Cmd.Parameters.Add("@BOQSection", SqlDbType.nvarchar).Value = _BOQSection
           Cmd.Parameters.Add("@Part", SqlDbType.nvarchar).Value = _Part
       Try
           Cmd.ExecuteNonQuery()
       Catch ex As SQLException
           Me._Msg="Error Message"
       Finally
           Try
               Me.conn.Close()
           Catch
           End Try
       End Try
   End Sub

   Public Sub delete()
   Getconnection()
           Dim sql As String = "DELETE from BOQSectionsAndParts Where BOQSectionsAndParts_ID= @BOQSectionsAndParts_ID"
           Dim Cmd As New SqlCommand(sql, Me.conn)
           Cmd.Parameters.Add("@BOQSectionsAndParts_ID", SqlDbType.int).Value = _BOQSectionsAndParts_ID
       Try
           Cmd.ExecuteNonQuery()
       Catch ex As SQLException
           Me._Msg="Error Message"
       Finally
           Try
               Me.conn.Close()
           Catch
           End Try
       End Try
   End Sub
   End Class 




   , what i can write inside add , delete, update button related with datagridview

     Imports System.Data
        Imports System.Data.SqlClient
        Public Class BOQSectionsAndParts

       Private _BOQSectionsAndParts_ID as Integer = 0
       Private _ProjectTenderingNO as String = ""
       Private _BOQSection as String = ""
       Private _Part as String = ""

       Public Property BOQSectionsAndParts_ID() As Integer
           Get
               Return Me._BOQSectionsAndParts_ID
           End Get
           Set(ByVal value As Integer)
               Me._BOQSectionsAndParts_ID= value
           End Set
       End Property

       Public Property ProjectTenderingNO() As String
           Get
               Return Me._ProjectTenderingNO
           End Get
           Set(ByVal value As String)
               Me._ProjectTenderingNO= value
           End Set
       End Property

       Public Property BOQSection() As String
           Get
               Return Me._BOQSection
           End Get
           Set(ByVal value As String)
               Me._BOQSection= value
           End Set
       End Property

       Public Property Part() As String
           Get
               Return Me._Part
           End Get
           Set(ByVal value As String)
               Me._Part= value
           End Set
       End Property
                 Private conn As Sqlconnection
                 Private _Msg As String = ""
         Public ReadOnly Property Msg() As String
             Get
                 Return Me._Msg
             End Get
         End Property


        Private Sub Getconnection()
            Try
                Dim DbConnection As String = System.Configuration.ConfigurationManager.ConnectionStrings("Tendering_System").ConnectionString
                Me.conn = New SqlConnection(DbConnection)
                Me.conn.Open()
            Catch ex As Exception
                Me._Msg = "We can not establish a connection to the database"
            End Try
        End Sub


       Public Sub add()
       Getconnection()
               Dim sql As String = "INSERT INTO BOQSectionsAndParts (ProjectTenderingNO, BOQSection, Part) VALUES(@ProjectTenderingNO, @BOQSection, @Part)"
               Dim Cmd As New SqlCommand(sql, Me.conn)
               Cmd.Parameters.Add("@ProjectTenderingNO", SqlDbType.nvarchar).Value = _ProjectTenderingNO
               Cmd.Parameters.Add("@BOQSection", SqlDbType.nvarchar).Value = _BOQSection
               Cmd.Parameters.Add("@Part", SqlDbType.nvarchar).Value = _Part
           Try
               Cmd.ExecuteNonQuery()
           Catch ex As SQLException
               Me._Msg="Error Message"
           Finally
               Try
                   Me.conn.Close()
               Catch
               End Try
           End Try
       End Sub


       Public Sub update()
       Getconnection()
               Dim sql As String = "UPDATE BOQSectionsAndParts Set ProjectTenderingNO= @ProjectTenderingNO, BOQSection= @BOQSection, Part= @Part Where BOQSectionsAndParts_ID = @BOQSectionsAndParts_ID"
               Dim Cmd As New SqlCommand(sql, Me.conn)
               Cmd.Parameters.Add("@BOQSectionsAndParts_ID", SqlDbType.int).Value = _BOQSectionsAndParts_ID
               Cmd.Parameters.Add("@ProjectTenderingNO", SqlDbType.nvarchar).Value = _ProjectTenderingNO
               Cmd.Parameters.Add("@BOQSection", SqlDbType.nvarchar).Value = _BOQSection
               Cmd.Parameters.Add("@Part", SqlDbType.nvarchar).Value = _Part
           Try
               Cmd.ExecuteNonQuery()
           Catch ex As SQLException
               Me._Msg="Error Message"
           Finally
               Try
                   Me.conn.Close()
               Catch
               End Try
           End Try
       End Sub

       Public Sub delete()
       Getconnection()
               Dim sql As String = "DELETE from BOQSectionsAndParts Where BOQSectionsAndParts_ID= @BOQSectionsAndParts_ID"
               Dim Cmd As New SqlCommand(sql, Me.conn)
               Cmd.Parameters.Add("@BOQSectionsAndParts_ID", SqlDbType.int).Value = _BOQSectionsAndParts_ID
           Try
               Cmd.ExecuteNonQuery()
           Catch ex As SQLException
               Me._Msg="Error Message"
           Finally
               Try
                   Me.conn.Close()
               Catch
               End Try
           End Try
       End Sub

First off, the methods in your class are sub procedures, not functions. Functions return a value or type, while sub procedures do not (really they return nothing). But enough of the lecture. On with the question at hand:

By call them,do you mean from another class? If so, you first have to instantiate the class:

Dim MyClass As New BOQSectionsAndParts

To call them, you use the reference defined above.

' Set a property
MyClass.BBQSection = "A Section"

' Call a procedure
MyClass.save

To call then without instantiating. You will have to change the methods to Shared Methods.

Public Shared Sub Save()

Then, you can call them without a reference:

BBQSectionParts.Save

i do this but didnt work , is there is other solution??

"it doesn't work" doesn't help us to narrow it down. There are a thousand and one ways for something not to work. In what way does it not work? Are you getting a runtime error message? Are you getting an error on build? If you are getting an error message then what is it? Please post the exact message and the line of code (perhaps a few lines on either side as well) where the error occurs.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.