我正在使用 Visual Studio 2019 创建一个库存控制程序,并一直尝试将其链接到其中一个表单的 Access 数据库。
但是,当我编码时,我的笔记本电脑意外崩溃,之后设计器代码中出现了错误。我知道您不应该编辑此代码,因此我不确定导致这些问题的原因。
也由于这个原因,我的表单变成了空白,但所有按钮、文本框等的代码仍然存在。
我一直在研究解决方案,但我只是尝试任何修复,因为我不想让问题变得更糟。
我已经包含了设计者的代码和错误的屏幕截图。
任何帮助将不胜感激,因为我担心我因遗憾地单击“忽略并继续”而破坏了代码。
谢谢,
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Partial Class Stock_Control
Inherits System.Windows.Forms.Form
'Form overrides dispose to clean up the component list.
<System.Diagnostics.DebuggerNonUserCode()>
Protected Overrides Sub Dispose(ByVal disposing As Boolean)
Try
If disposing AndAlso components IsNot Nothing Then
components.Dispose()
End If
Finally
MyBase.Dispose(disposing)
End Try
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
<System.Diagnostics.DebuggerStepThrough()>
Private Sub InitializeComponent()
Me.SuspendLayout()
'
'Stock_Control
'
Me.ClientSize = New System.Drawing.Size(284, 261)
Me.Name = "Stock_Control"
Me.ResumeLayout(False)
End Sub
Friend WithEvents StockControlDatabaseDataSet As Stock_Control.StockControlDatabaseDataSet
Friend WithEvents CustomerBindingSource As BindingSource
Friend WithEvents CustomerTableAdapter As Stock_Control.StockControlDatabaseDataSetTableAdapters.CustomerTableAdapter
Friend WithEvents TableAdapterManager As Stock_Control.StockControlDatabaseDataSetTableAdapters.TableAdapterManager
Friend WithEvents CustomerBindingNavigator As BindingNavigator
Friend WithEvents BindingNavigatorAddNewItem As ToolStripButton
Friend WithEvents BindingNavigatorCountItem As ToolStripLabel
Friend WithEvents BindingNavigatorDeleteItem As ToolStripButton
Friend WithEvents BindingNavigatorMoveFirstItem As ToolStripButton
Friend WithEvents BindingNavigatorMovePreviousItem As ToolStripButton
Friend WithEvents BindingNavigatorSeparator As ToolStripSeparator
Friend WithEvents BindingNavigatorPositionItem As ToolStripTextBox
Friend WithEvents BindingNavigatorSeparator1 As ToolStripSeparator
Friend WithEvents BindingNavigatorMoveNextItem As ToolStripButton
Friend WithEvents BindingNavigatorMoveLastItem As ToolStripButton
Friend WithEvents BindingNavigatorSeparator2 As ToolStripSeparator
Friend WithEvents CustomerBindingNavigatorSaveItem As ToolStripButton
Friend WithEvents ItemTableAdapter As Stock_Control.StockControlDatabaseDataSetTableAdapters.ItemTableAdapter
Friend WithEvents Customer_IDTextBox As TextBox
Friend WithEvents FirstnameTextBox As TextBox
Friend WithEvents LastnameTextBox As TextBox
Friend WithEvents Street_AddressTextBox As TextBox
Friend WithEvents Town_CityTextBox As TextBox
Friend WithEvents PostcodeTextBox As TextBox
Friend WithEvents CountyTextBox As TextBox
Friend WithEvents New_CustomerCheckBox As CheckBox
Friend WithEvents ItemBindingSource As BindingSource
Friend WithEvents OrderTableAdapter As Stock_Control.StockControlDatabaseDataSetTableAdapters.OrderTableAdapter
Friend WithEvents Item_IDTextBox As TextBox
Friend WithEvents ItemTextBox As TextBox
Friend WithEvents BrandTextBox As TextBox
Friend WithEvents ColourTextBox As TextBox
Friend WithEvents SizeTextBox As TextBox
Friend WithEvents StyleTextBox As TextBox
Friend WithEvents PopularityTextBox As TextBox
Friend WithEvents Cost_of_ItemTextBox As TextBox
Friend WithEvents Stock_LevelTextBox As TextBox
Friend WithEvents Reorder_LevelTextBox As TextBox
Friend WithEvents Out_of_Stock_LevelTextBox As TextBox
Friend WithEvents Remaining_StockTextBox As TextBox
Friend WithEvents OrderBindingSource As BindingSource
Friend WithEvents Order_IDTextBox As TextBox
Friend WithEvents Item_IDTextBox1 As TextBox
Friend WithEvents Customer_IDTextBox1 As TextBox
Friend WithEvents Sale_PriceTextBox As TextBox
Friend WithEvents Delivery_ChargeTextBox As TextBox
Friend WithEvents PromotionTextBox As TextBox
Friend WithEvents Place_of_SaleTextBox As TextBox
Friend WithEvents ReturnedCheckBox As CheckBox
Friend WithEvents Date_of_SaleDateTimePicker As DateTimePicker
Friend WithEvents Date_OrderedDateTimePicker As DateTimePicker
Friend WithEvents Quanitity_OrderedTextBox As TextBox
Friend WithEvents Cost_of_DeliveryTextBox As TextBox
Friend WithEvents CustomerGroupBox As GroupBox
Friend WithEvents ItemGroupBox As GroupBox
Friend WithEvents OrderGroupBox As GroupBox
Friend WithEvents OrderDataGridView As DataGridView
Friend WithEvents DataGridViewTextBoxColumn1 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn2 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn3 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn4 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn5 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn6 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn7 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewCheckBoxColumn1 As DataGridViewCheckBoxColumn
Friend WithEvents DataGridViewTextBoxColumn8 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn9 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn10 As DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn11 As DataGridViewTextBoxColumn
Friend WithEvents CommandsGroupBox As GroupBox
Friend WithEvents AddNewButton As Button
Friend WithEvents Button3 As Button
Friend WithEvents Button2 As Button
Friend WithEvents Button4 As Button
Friend WithEvents Button5 As Button
Friend WithEvents KeywordTextBox As TextBox
End Class
好吧,这有点像死线程,但我刚刚遇到了这个问题,它似乎完全是 Visual Studio 生成的代码的错误。
看看你的代码中如何指定它所抱怨的变量的 scope 未定义? 删除
Stock_Control.
前缀。
Friend WithEvents OrderTableAdapter As Stock_Control.StockControlDatabaseDataSetTableAdapters.OrderTableAdapter
变为 Friend WithEvents OrderTableAdapter As StockControlDatabaseDataSetTableAdapters.OrderTableAdapter
。我不知道为什么 Visual Studio 决定它生成的变量在该范围内,但它却无法在该范围内找到它们。
(我在向我的应用程序添加 DataGridView 时遇到了这个问题,它非常高兴地加载了列标题并让我用实际数据预览表,但是当我进行编译时,由于这些变量范围问题而因构建错误而失败。)