VS 2022项目缺少x64选项,只有Any CPU作为选项



我已经无计可施了。我有一个VS 2022 VB Winforms应用程序,直到昨晚才工作得很好。现在我得到了许多错误,其中大多数状态"类型'ComboBox()'的值不能转换为'ComboBox()',因为'ComboBox'不是派生自'ComboBox'"。另一个错误提示"'DropDownWidth'不是'ComboBox'的成员"。我注意到的唯一一件事是,解决方案平台现在读取"任何cpu"。而不是"x64"。我没有更改任何与组合框例程有关的代码,因此错误似乎无处不在,x64解决方案平台不再是一种选择。什么好主意吗?我包含了我的代码,错误开始弹出。

Public Class GlobalVar
Public Shared cmbBurgType() As ComboBox = {frmSearchNOC.cmbSearchBurgType, frmAddEntry.cmbAddBurgType}
Public Shared cmbSex() As ComboBox = {frmSearchNOC.cmbSearchSex, frmAddEntry.cmbAddSex}
Public Shared cmbRace() As ComboBox = {frmSearchNOC.cmbSearchRace, frmAddEntry.cmbAddRace}
Public Shared cmbPrefix() As ComboBox = {frmSearchNOC.cmbSearchHomeStreetPrefix, frmAddEntry.cmbAddHAddressPrefix}
Public Shared cmbSuffix() As ComboBox = {frmSearchNOC.cmbSearchHomeStreetSuffix, frmAddEntry.cmbAddHAddressSuffix}
Public Shared cmbState() As ComboBox = {frmSearchNOC.cmbSearchHomeState, frmAddEntry.cmbAddHAddressState}
Public Shared cmbPrecinct() As ComboBox = {frmSearchNOC.cmbSearchHomePrecinct, frmAddEntry.cmbAddHAddressPrecinct}
Public Shared cmbTattooLoc() As ComboBox = {frmSearchNOC.cmbSearchTattooLocation, frmAddEntry.cmbAddTattoo}
End Class


Public Sub LoadPresetDBDataCombobox(tableName As String, colName As String, objArray() As ComboBox)
Dim longestEntry As String = ""
Dim curText As String = ""
Dim sqliteReader As SQLiteDataReader
Dim sqliteReadCmd As SQLiteCommand
'clear combobox items
For Each curBox As ComboBox In objArray
curBox.Items.Clear()
Next
OpenDBConn() 'opens the database connection
sqliteReadCmd = GlobalVar.dbConn.CreateCommand()
sqliteReadCmd.CommandText = "Select " & colName & " FROM " & tableName
sqliteReader = sqliteReadCmd.ExecuteReader()
sqliteReadCmd.Dispose() 'disposes read command after it is used
'iterate through table
Using sqliteReader
While sqliteReader.Read
curText = sqliteReader.GetString(colName) 'gets the current table value for the selcted column
'places value into each combobox in array
For Each curBox As ComboBox In objArray
curBox.Items.Add(curText)
Next

'determines the length of the longest string to size to properly dize the drop down width to fit text
If (curText.Length > longestEntry.Length) Then
longestEntry = curText
End If
End While

'assigns the dropdownwidth based on an everage character width of 6 pixels
For Each curBox As ComboBox In objArray
curBox.DropDownWidth = ((longestEntry.Length * 7) + 10)
Next

sqliteReader.Close() 'close object
longestEntry = ""
End Using
CloseDBConn() 'closes the database connection
End Sub


Private Sub OpenChildForm(childForm As Form, formIndex As Integer)
If (currentChildForm IsNot Nothing) Then
currentChildForm.SendToBack()
End If

currentChildForm = childForm 'assigns passed in form as current form
childForm.TopLevel = False 'indicated the form is not top level because the main form is top level
childForm.Dock = DockStyle.Fill 'docks form to fill main form's panel
pnlMain.Controls.Add(childForm) 'adds form to the main panel on the main form
pnlMain.Tag = childForm 'associate form to main panel on main form
childForm.BringToFront() 'brings the related form to the front
childForm.Show()
Select Case formIndex
Case 0 'search noc form
'reloads various data from db into comboboxes in case items were added while on another tab
LoadPresetDBDataCombobox("BurgType", "typeName", GlobalVar.cmbBurgType) 'tattoo location
LoadPresetDBDataCombobox("Sex", "sexName", GlobalVar.cmbSex) 'sex
LoadPresetDBDataCombobox("Race", "raceName", GlobalVar.cmbRace) 'race
LoadPresetDBDataCombobox("StreetPrefix", "prefixName", GlobalVar.cmbPrefix) 'street prefix
LoadPresetDBDataCombobox("StreetSuffix", "suffixName", GlobalVar.cmbSuffix) 'street suffix
LoadPresetDBDataCombobox("State", "stateName", GlobalVar.cmbState) 'state
LoadPresetDBDataCombobox("Precinct", "precinctName", GlobalVar.cmbPrecinct) 'home precinct
LoadPresetDBDataCombobox("BodyPart", "bodyPartName", GlobalVar.cmbTattooLoc) 'tattoo location
Case 1 'browse results form
Case 2 'add entry form
'reloads various data from db into comboboxes in case items were added while on another tab
LoadPresetDBDataCombobox("BurgType", "typeName", GlobalVar.cmbBurgType) 'tattoo location
LoadPresetDBDataCombobox("Sex", "sexName", GlobalVar.cmbSex) 'sex
LoadPresetDBDataCombobox("Race", "raceName", GlobalVar.cmbRace) 'race
LoadPresetDBDataCombobox("StreetPrefix", "prefixName", GlobalVar.cmbPrefix) 'street prefix
LoadPresetDBDataCombobox("StreetSuffix", "suffixName", GlobalVar.cmbSuffix) 'street suffix
LoadPresetDBDataCombobox("State", "stateName", GlobalVar.cmbState) 'state
LoadPresetDBDataCombobox("Precinct", "precinctName", GlobalVar.cmbPrecinct) 'home precinct
LoadPresetDBDataCombobox("BodyPart", "bodyPartName", GlobalVar.cmbTattooLoc) 'tattoo location
Case 3'user settings form
Case 4 'administrator form
End Select
End Sub

上面,所有的GlobalVar参数以及dropdownwidth调用都会产生错误:

LoadPresetDBDataCombobox("StreetPrefix", "prefixName", GlobalVar.cmbPrefix)
curBox.DropDownWidth = ((longestEntry.Length * 7) + 10)

我尝试更新VS 2022,然后重新安装它。显然,考虑到我在问这个问题,这两种方法都不起作用。这可能是一些简单而愚蠢的事情,但我很忙,可能需要一些帮助。

感谢花时间阅读我问题的人。我不知道如何或何时将以下导入添加到我的一个例程中,但我将其注释掉,所有错误都消失了:

Imports System.Windows.Controls

我注意到,当我从我的破碎项目复制代码到一个新的项目,看看错误何时开始弹出。我最好的猜测是,它正在导入一个与我试图传递到例程中的组合框不同的组合框控件,但是任何解释原因的注释都是赞赏的。

最新更新