Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27554

VS 2008 Call Sub / Method from another Class/Form

$
0
0
Dear Friends,

i have some codes below :

Code:

Imports System.Data.SqlClient

Public Class FormMasterEkspedisi
    Dim NewRecord As Boolean = True
    Dim DataChanged As Boolean = False
    Dim ObjConnection As SqlConnection
    Dim ConStr As String = "Data Source=.;Initial Catalog=WH;User Id=sa;Password=sa"
    Dim ObjTransaction As SqlTransaction
    '...


    Public Sub KonekLokalWH()
        If ObjConnection Is Nothing Then
            ObjConnection = New SqlConnection(ConStr)
         
        End If
        If ObjConnection.State = ConnectionState.Closed Then
            ObjConnection.Open()
        End If
    End Sub

Then i want to access Sub KonekLokalWH() from Other Form i.e. : Form2
how can i do that ? it shows error even i already use Public Sub KonekLokalWH() :o
the error is :
Error 2 Name 'KonekLokalWH' is not declared. D:\KERJAAN\Ekspedisi\Ekspedisi\FrmTransaksi.vb 359 13 Ekspedisi

Thank you very much :)

Viewing all articles
Browse latest Browse all 27554

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>