由于保护级别vs2010,1个单词导致此>未声明可能无法访问 [英] 1 word causes this >is not declared it may be inaccessible due to protection level vs2010

查看:141
本文介绍了由于保护级别vs2010,1个单词导致此>未声明可能无法访问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我在visual basic 2010 ultimate中使用的代码。

我还使用了以下youtube链接。它或多或少都是一样的,但我似乎无法找到导致错误的原因。错误是在哪里说grdProperties



http:/ /www.youtube.com/watch?v=4H2g8H0bqEg [ ^ ]



this the code I am using in visual basic 2010 ultimate.
I have also used the following youtube link. It is more or less all the same but I cant seem to find what is causing the error. The error is where is says "grdProperties"

http://www.youtube.com/watch?v=4H2g8H0bqEg[^]

Imports System.Data.OleDb
Public Class Form1

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        OleDbDataAdapter1.Fill(DataSet11)
    End Sub

    Private Sub LandlordID_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles LandlordID.SelectedIndexChanged
        Dim ID, SQLString As String
        Dim dtProperties As New DataTable()
        Dim dbDataAdapter As OleDbDataAdapter
        Dim ConnectString As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source = Database.accdb"
        ID = LandlordID.Text
        SQLString = "Select * From Properties WHERE ID = " & "'" & ID & "'" & ""
        dbDataAdapter = New OleDbDataAdapter(SQLString, ConnectString)
        grdProperties.DataSource = dtProperties
    End Sub

    Private Sub postcodes_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles postcodes.SelectedIndexChanged
        Dim postcode, SQLString As String
        Dim dtProperties As New DataTable()
        Dim dbDataAdapter As OleDbDataAdapter
        Dim ConnectString As String = "Provider = Microsoft.Jet.OLEDB.4.0;" & "Data Source = Database.accdb"
        postcode = postcodes.Text
        SQLString = "Select * From Properties WHERE postcode = " & postcode & ""
        dbDataAdapter = New OleDbDataAdapter(SQLString, ConnectString)
        dbDataAdapter.Fill(dtProperties)
        grdProperties.DataSource = dtProperties
    End Sub
End Class

推荐答案

在设计器中检查控件的名称(我假设它是一个DataGridView?) - 它不叫 grdProperties !如果是,那么它将在表单中声明和访问。您是否将其添加到了错误的表单中?
Check the name of your control (I assume it''s a DataGridView?) in the designer - it isn''t called grdProperties! If it is, then it would be both declared and accessible within the form. Did you add it to the wrong form?


这篇关于由于保护级别vs2010,1个单词导致此>未声明可能无法访问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆