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

问题描述

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

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



[]



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

推荐答案


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

08-28 08:25