Visual Studio 2010 - 数据库/ MS ACCESS错误(未声明'TextBox1'。由于其保护级别,它可能无法访问。) [英] Visual Studio 2010 - Database/MS ACCESS errors ('TextBox1' is not declared. It may be inaccessible due to its protection level.)

查看:102
本文介绍了Visual Studio 2010 - 数据库/ MS ACCESS错误(未声明'TextBox1'。由于其保护级别,它可能无法访问。)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好!我想问一下,如果想要解决这个错误。我已经尝试了错误更正选项,我必须在'PrelimExam.UpdateInformation'中为'TextBox1'生成方法存根。但它永远不会有效...希望有人可以帮助我.. :)

Hello! I would like to ask if want is the solution in this errors. I already tried the error correction options in which I have to generate methods stub for 'TextBox1' in 'PrelimExam.UpdateInformation'. but it never works...Hope someone could help me..:)

以下是我一直在制作的指定代码:

Here are the specify code that I've been making:

Imports System.Data.OleDb
Public Class UpdateInformation

    Private Sub BtnUpdated_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnUpdated.Click
        Dim dr As New DialogResult
        dr = MessageBox.Show("Are you sure you want to Update?", "Change Details", MessageBoxButtons.OKCancel, MessageBoxIcon.Question)
        If dr = Windows.Forms.DialogResult.OK Then
            If con.State = ConnectionState.Closed Then con.Open()
            Dim st As String = "UPDATE [PersonalInfo] SET IDNumber = '" & TxtIDNumber.Text & _
                                "', FirstName = '" & TxtFirstName.Text & "', LastName = '" & TxtLastName.Text & _
                                "', MiddleName = '" & TxtMiddleName.Text & "', Address = '" & TxtAddress.Text & _
                                "'  WHERE IDNumber = '" & PersonalInformation.DataGridView1.SelectedCells(0).Value & "'"
            MessageBox.Show("Process Successful!", "Edit", MessageBoxButtons.OK, MessageBoxIcon.Information)
            Dim cmd As New OleDbCommand(st, con)
            cmd.ExecuteNonQuery()
            con.Close()
            PersonalInformation.fill()
            Me.Close()
        End If
    End Sub

以下是错误:

Error	6	'TxtIDNum' is not declared. It may be inaccessible due to its protection level.	

Error	7	'TxtFirstName' is not declared. It may be inaccessible due to its protection level.	

Error	8	'TxtLastName' is not declared. It may be inaccessible due to its protection level.	

Error	9	'TxtMiddleName' is not declared. It may be inaccessible due to its protection level.	

Error	10	'TxtAddress' is not declared. It may be inaccessible due to its protection level.	


他们都有相同的错误,但我不能指出我应该在哪里更改我的代码。

They all have the same errors but I cant pin point where should i change my codes.

推荐答案

嗨!我几乎在visual basic中完成了我的代码,但是有一个错误不断出现。我已经搜索结果但没有运气。希望你能帮助我。这是代码和错误。 :)

Hi! I almost finishing my code in visual basic but there is an errors keep popping out. I already search for the result but no luck. Wish you can help me. here are the codes and the errors. :)

Public Sub BtnEdit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtnEdit.Click UpdateInformation.TxtIDNum.Text = Me.DataGridView1.SelectedCells(0).Value.ToString UpdateInformation.TxtFirstName.Text = Me.DataGridView1.SelectedCells(1).Value.ToString UpdateInformation.TxtLastName.Text = Me.DataGridView1.SelectedCells(2).Value.ToString UpdateInformation.TxtMiddleName.Text = Me.DataGridView1.SelectedCells(3).Value.ToString UpdateInformation.TxtAddress.Text = Me.DataGridView1.SelectedCells(4).Value.ToString UpdateInformation.Show() End Sub


Errors
Error	1	'TxtIDNum' is not a member of 'PrelimExam.UpdateInformation'.	

Error	2	'TxtFirstName' is not a member of 'PrelimExam.UpdateInformation'.	
Error	3	'TxtLastName' is not a member of 'PrelimExam.UpdateInformation'.	
Error	4	'TxtMiddleName' is not a member of 'PrelimExam.UpdateInformation'.	
Error	5	'TxtAddress' is not a member of 'PrelimExam.UpdateInformation'.	




UpdateInformation是另一种形式,我必须以我的第一种形式链接它,名为PersonalInformation。因此,UpdateInformation的信息然后反转。


UpdateInformation is an another form, I have to link it in my first form which is named PersonalInformation. So, Information to UpdateInformation then reversed.

Here are the Error correction options in one of the textbox named TxtIDNum:
Generate method stub for 'TxtIDNum' in 'PrelimExam.UpdateInformation'

Generate Property stub for 'TxtIDNum' in 'PrelimExam.UpdateInformation'

Generate field for 'TxtIDNum' in 'PrelimExam.UpdateInformation'


这篇关于Visual Studio 2010 - 数据库/ MS ACCESS错误(未声明'TextBox1'。由于其保护级别,它可能无法访问。)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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