Public Class frmLogin
Dim cnt As Integer
Dim fd As Integer
Private Property CM As Object
Private Sub frmLogin_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles MyBase.Load
Me.UserTableAdapter.Fill(Me.CourtMDataSet.UserInformation)
Cbotype.SelectedIndex = 0
If userID = "" Then
cnt = 0
txtuser.Text = "csu"
txtpwd.Text = "csu"
End If
End Sub
Private Sub Button1_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button1.Click
cnt = cnt + 1
If cnt = 3 Then
End
End If
If Trim(txtuser.Text) = "" Then
MsgBox("請輸入用戶名", vbOKOnly + vbExclamation, "")
Exit Sub
End If
fd = UserBindingSourse.Find("username", Trim(txtuser.Text))
If fd = -1 Then
MsgBox("沒有這個用戶", vbOKOnly + vbExclamation, "")
Exit Sub
End If
UserBindingSourse.Position = fd
If Trim(UserBindingSourse.Current(2).ToString) <> Trim(Cbotype.Text) Then
MsgBox("沒有符合條件的用戶", vbOKOnly + vbExclamation, "")
Exit Sub
End If
If Trim(UserBindingSourse.Current(1).ToString) = Trim(txtpwd.Text) Then
userID = txtuser.Text
If Trim(Cbotype.Text) = "管理員" Then
usertype = 1
Else
usertype = 2
End If
Me.Dispose()
CM.vbMain.Show()
Else
MsgBox("密碼不正確", vbOKOnly + vbExclamation, "")
Exit Sub
End If
End Sub
Private Sub Button2_Click(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles Button2.Click
Me.Dispose()
End Sub
Private Sub Cbotype_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub Cbotype_SelectedIndexChanged_1(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub txtuser_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Cbotype.SelectedIndexChanged
End Sub
Private Function UserBindingSourse() As Object
Me.Hide()
CMFrmMain.Show()
End Function
End Class
紅色那句報錯說未設定什么什么的
這是我們大學課程設計。。但是因為完全沒學過所以是從書上抄的代碼
求解決啊。。
uj5u.com熱心網友回復:
fd = UserBindingSourse.Find("username", Trim(txtuser.Text))這句
uj5u.com熱心網友回復:
應該是UserBindingSourse 這玩意的需要的東西沒有參考或者沒有宣告uj5u.com熱心網友回復:
我看到你這兒的代碼,UserBindingSourse是個“函式”:Private Function UserBindingSourse() As Object
然而,在“函式體”內部并沒有對其賦值,那么它的值應該是“默認值”:Nothing
此函式回傳后、再呼叫“物件方法/函式”,必然會有這種提示。
你的“前一個帖子”中,據你據說是可以“正常”運行的,你這回沒有把代碼Copy完整吧!
你應該參考之前的代碼,進行相應的修正。
uj5u.com熱心網友回復:
Private type UserBindingSoursefind as .......
end type
uj5u.com熱心網友回復:
你這個需要參考,你要查看相關手冊,這個到底是包含自哪個的。uj5u.com熱心網友回復:
UserBindingSourse是個“函式”:Private Function UserBindingSourse() As Object
然而,在“函式體”內部并沒有對其賦值,那么它的值應該是“默認值”:Nothing
此函式回傳后、再呼叫“物件方法/函式”,必然會有這種提示。
轉載請註明出處,本文鏈接:https://www.uj5u.com/gongcheng/43613.html
標籤:VB基礎類
下一篇:抓取查快遞資料
