whenever I want to create a multi user loginform this error pops up and gives me this notification
(System.NullReferenceException: 'Object variable or With block variable not set.' )
Imports System.Data.SqlClient
Public Class Form1
Private Sub Btnlogin_Click(sender As Object, e As EventArgs) Handles btnlogin.Click
Dim con As New SqlConnection("Data Source=Karwan;Initial Catalog=login;Integrated Security=True")
Dim txtuser As Object = Nothing
Dim txtpass As Object = Nothing
Dim cmbusertype As Object = Nothing
Dim cmd As SqlCommand = New SqlCommand(" select * from login where username='" & txtuser.Text & "'and password='" & txtpass.Text & "' and usertype= '" & cmbusertype.SelectedItem & "'", con)
Dim sda As SqlDataAdapter = New SqlDataAdapter(cmd)
Dim dt As DataTable = New DataTable()
sda.Fill(dt)
If (dt.Rows.Count > 0) Then
MessageBox.Show("چوونە ژوورەوە سەرکەوتوو بوو" + dt.Rows(0)(2))
If (cmbusertype.selectedindex = 0) Then
Dim a As New Admin
a.Show()
Me.Hide()
Else
Dim u As New User
u.Show()
Me.Hide()
End If
Else
MessageBox.Show("زانیاریەکانت هەڵەیە")
End If
End Sub
End Class