注册 登录
编程论坛 VB.NET论坛

未将对象引用设置到对象的实例

发布于 2010-04-30 18:31, 982 次点击
程序代码:
      If TreeView1.SelectedNode.Text <> "我的通讯录" Then
            Dim string1 As String = TreeView1.SelectedNode.Text
            Dim toshowNode As String = string1.Substring(1, string1.Length - 3)
            Dim toshowView As DataView = New DataView(myDataSet.Tables("lianxiren"))  未将对象引用设置到对象的实例。
            toshowView.RowFilter = "分组 = '" + toshowNode + "'"
            Dim toshowTable As New DataTable("showlianxiren")
            toshowTable = toshowView.ToTable()
            myDataSet.Tables.Add("showlianxiren")

            DataGridView1.AutoGenerateColumns = True
            DataGridView1.DataSource = myDataSet
            DataGridView1.DataMember = "showlianxiren"
     End If
加粗行出现错误
2 回复
#2
sywzs2010-04-30 20:34
可能是 myDataSet 未声明或者 Tables("lianxiren") 不存在。
#3
2010-05-01 09:41
额 ,解决了 ,字符串搞错了,太菜了
1