Object reference not set to an instance of an object
je recoi toujour ce message "object reference not set to an instance of an object "
code form:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| Imports System.Data.SqlClient
Public Class FormLogin
Private Sub FormLogin_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Try
Class1.sqlcon.ConnectionString = "Data Source = BUCOMPT;Initial Catalog=test; Integrated Security=True"
MsgBox("تم اللإتصال بنجاح", MsgBoxStyle.Exclamation)
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
End Class |
code class:
Code:
1 2 3 4
| Imports System.Data.SqlClient
Public Class Class1
Public Shared sqlcon As SqlConnection
End Class |
code module:
Code:
1 2 3
| Module Module1
Public Part As New Class1
End Module |