| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1437 人关注过本帖
标题:vb中未设置对象变量或with块变量怎么解决?
只看楼主 加入收藏
anniegao
Rank: 1
等 级:新手上路
帖 子:1
专家分:0
注 册:2018-5-27
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
vb中未设置对象变量或with块变量怎么解决?
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

大学要做的课程设计
因为没学所以是抄书上的代码
它报错我完全不懂。。
是红色那一句出了问题fd = UserBindingSourse.Find("username", Trim(txtuser.Text))这个
求解决啊。。跪求
搜索更多相关主题的帖子: Sub ByVal End System If 
2018-05-27 23:28
ZHRXJR
Rank: 16Rank: 16Rank: 16Rank: 16
等 级:版主
威 望:125
帖 子:1034
专家分:5519
注 册:2016-5-10
收藏
得分:20 
fd = UserBindingSourse.Find("username", Trim(txtuser.Text))
估计你的窗体没有 txtuser.Text 控件

请不要选我!!!
2018-05-28 20:08
快速回复:vb中未设置对象变量或with块变量怎么解决?
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013406 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved