gpt4 book ai didi

VB.Net 设计器错误(类型 'String' 的值无法转换为 'System.Windows.Forms.DataGridViewTextBoxColumn' 。)

转载 作者:行者123 更新时间:2023-12-02 01:06:00 26 4
gpt4 key购买 nike

我在名为 frmTeacherload 的表单上有一个数据网格,当我运行代码时突然出现此错误“字符串”类型的值无法转换为“System.Windows.Forms.DataGridViewTextBoxColumn”。关于vb的设计器。这是我的代码人员,我希望你能帮助我提前谢谢

设计师代码 _ 部分类 frmTeacherload 继承 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.components = New System.ComponentModel.Container()
Me.Label1 = New System.Windows.Forms.Label()
Me.Label2 = New System.Windows.Forms.Label()
Me.ComboBox1 = New System.Windows.Forms.ComboBox()
Me.lblBack = New System.Windows.Forms.LinkLabel()
Me.Panel1 = New System.Windows.Forms.Panel()
Me.DataGridView2 = New System.Windows.Forms.DataGridView()
Me.Name = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.TblteacherloadDataSet2 = New WindowsApplication1.tblteacherloadDataSet2()
Me.TblteacherloadDataSet1 = New WindowsApplication1.tblteacherloadDataSet1()
Me.TblteacherloadTableAdapter = New WindowsApplication1.tblteacherloadDataSet1TableAdapters.tblteacherloadTableAdapter()
Me.TextBox1 = New System.Windows.Forms.TextBox()
Me.Label3 = New System.Windows.Forms.Label()
Me.Label4 = New System.Windows.Forms.Label()
Me.TextBox2 = New System.Windows.Forms.TextBox()
Me.Label5 = New System.Windows.Forms.Label()
Me.TextBox3 = New System.Windows.Forms.TextBox()
Me.Label6 = New System.Windows.Forms.Label()
Me.TextBox4 = New System.Windows.Forms.TextBox()
Me.Label7 = New System.Windows.Forms.Label()
Me.TextBox5 = New System.Windows.Forms.TextBox()
Me.Label8 = New System.Windows.Forms.Label()
Me.TextBox6 = New System.Windows.Forms.TextBox()
Me.Label9 = New System.Windows.Forms.Label()
Me.TextBox7 = New System.Windows.Forms.TextBox()
Me.Button1 = New System.Windows.Forms.Button()
Me.TblteacherloadTableAdapter1 = New WindowsApplication1.tblteacherloadDataSet2TableAdapters.tblteacherloadTableAdapter()
Me.TblteacherloadDataSet3 = New WindowsApplication1.tblteacherloadDataSet3()
Me.BindingSource1 = New System.Windows.Forms.BindingSource(Me.components)
Me.TblteacherloadTableAdapter2 = New WindowsApplication1.tblteacherloadDataSet3TableAdapters.tblteacherloadTableAdapter()
Me.DataGridViewTextBoxColumn1 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.NameDataGridViewTextBoxColumn = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn2 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn3 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn4 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn5 = New System.Windows.Forms.DataGridViewTextBoxColumn()
Me.DataGridViewTextBoxColumn6 = New System.Windows.Forms.DataGridViewTextBoxColumn()
CType(Me.DataGridView2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TblteacherloadDataSet2, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TblteacherloadDataSet1, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.TblteacherloadDataSet3, System.ComponentModel.ISupportInitialize).BeginInit()
CType(Me.BindingSource1, System.ComponentModel.ISupportInitialize).BeginInit()
Me.SuspendLayout()
'
'Label1
'
Me.Label1.AutoSize = True
Me.Label1.Font = New System.Drawing.Font("Lucida Calligraphy", 18.0!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Label1.Location = New System.Drawing.Point(610, 18)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(217, 31)
Me.Label1.TabIndex = 0
Me.Label1.Text = "Teacher's Load"
'
'Label2
'
Me.Label2.AutoSize = True
Me.Label2.Location = New System.Drawing.Point(22, 74)
Me.Label2.Name = "Label2"
Me.Label2.Size = New System.Drawing.Size(125, 13)
Me.Label2.TabIndex = 1
Me.Label2.Text = "Choose Teachers Name:"
'
'ComboBox1
'
Me.ComboBox1.FormattingEnabled = True
Me.ComboBox1.Location = New System.Drawing.Point(149, 70)
Me.ComboBox1.Name = "ComboBox1"
Me.ComboBox1.Size = New System.Drawing.Size(121, 21)
Me.ComboBox1.TabIndex = 2
'
'lblBack
'
Me.lblBack.AutoSize = True
Me.lblBack.Location = New System.Drawing.Point(22, 30)
Me.lblBack.Name = "lblBack"
Me.lblBack.Size = New System.Drawing.Size(50, 13)
Me.lblBack.TabIndex = 94
Me.lblBack.TabStop = True
Me.lblBack.Text = "<<<Back"
'
'Panel1
'
Me.Panel1.BackColor = System.Drawing.Color.Black
Me.Panel1.Location = New System.Drawing.Point(549, 52)
Me.Panel1.Name = "Panel1"
Me.Panel1.Size = New System.Drawing.Size(272, 10)
Me.Panel1.TabIndex = 95
'
'DataGridView2
'
Me.DataGridView2.AutoGenerateColumns = False
Me.DataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize
Me.DataGridView2.Columns.AddRange(New System.Windows.Forms.DataGridViewColumn() {Me.Name, Me.DataGridViewTextBoxColumn1, Me.NameDataGridViewTextBoxColumn, Me.DataGridViewTextBoxColumn2, Me.DataGridViewTextBoxColumn3, Me.DataGridViewTextBoxColumn4, Me.DataGridViewTextBoxColumn5, Me.DataGridViewTextBoxColumn6})
Me.DataGridView2.DataSource = Me.BindingSource1
Me.DataGridView2.Location = New System.Drawing.Point(45, 97)
Me.DataGridView2.Name = "DataGridView2"
Me.DataGridView2.Size = New System.Drawing.Size(753, 178)
Me.DataGridView2.TabIndex = 96
'
'Name
'
Me.Name.DataPropertyName = "Name"
Me.Name.HeaderText = "Name"
Me.Name.Name = "Name"
'
'TblteacherloadDataSet2
'
Me.TblteacherloadDataSet2.DataSetName = "tblteacherloadDataSet2"
Me.TblteacherloadDataSet2.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'TblteacherloadDataSet1
'
Me.TblteacherloadDataSet1.DataSetName = "tblteacherloadDataSet1"
Me.TblteacherloadDataSet1.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'TblteacherloadTableAdapter
'
Me.TblteacherloadTableAdapter.ClearBeforeFill = True
'
'TextBox1
'
Me.TextBox1.Location = New System.Drawing.Point(123, 303)
Me.TextBox1.Name = "TextBox1"
Me.TextBox1.Size = New System.Drawing.Size(100, 20)
Me.TextBox1.TabIndex = 97
'
'Label3
'
Me.Label3.AutoSize = True
Me.Label3.Location = New System.Drawing.Point(33, 306)
Me.Label3.Name = "Label3"
Me.Label3.Size = New System.Drawing.Size(18, 13)
Me.Label3.TabIndex = 98
Me.Label3.Text = "ID"
'
'Label4
'
Me.Label4.AutoSize = True
Me.Label4.Location = New System.Drawing.Point(33, 351)
Me.Label4.Name = "Label4"
Me.Label4.Size = New System.Drawing.Size(85, 13)
Me.Label4.TabIndex = 100
Me.Label4.Text = "Teacher's Name"
'
'TextBox2
'
Me.TextBox2.Location = New System.Drawing.Point(123, 348)
Me.TextBox2.Name = "TextBox2"
Me.TextBox2.Size = New System.Drawing.Size(100, 20)
Me.TextBox2.TabIndex = 99
'
'Label5
'
Me.Label5.AutoSize = True
Me.Label5.Location = New System.Drawing.Point(337, 310)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(43, 13)
Me.Label5.TabIndex = 104
Me.Label5.Text = "Subject"
'
'TextBox3
'
Me.TextBox3.Location = New System.Drawing.Point(123, 393)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(100, 20)
Me.TextBox3.TabIndex = 103
'
'Label6
'
Me.Label6.AutoSize = True
Me.Label6.Location = New System.Drawing.Point(33, 394)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(43, 13)
Me.Label6.TabIndex = 102
Me.Label6.Text = "Section"
'
'TextBox4
'
Me.TextBox4.Location = New System.Drawing.Point(427, 303)
Me.TextBox4.Name = "TextBox4"
Me.TextBox4.Size = New System.Drawing.Size(100, 20)
Me.TextBox4.TabIndex = 101
'
'Label7
'
Me.Label7.AutoSize = True
Me.Label7.Location = New System.Drawing.Point(337, 393)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(30, 13)
Me.Label7.TabIndex = 108
Me.Label7.Text = "Time"
'
'TextBox5
'
Me.TextBox5.Location = New System.Drawing.Point(427, 345)
Me.TextBox5.Name = "TextBox5"
Me.TextBox5.Size = New System.Drawing.Size(100, 20)
Me.TextBox5.TabIndex = 107
'
'Label8
'
Me.Label8.AutoSize = True
Me.Label8.Location = New System.Drawing.Point(337, 348)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(26, 13)
Me.Label8.TabIndex = 106
Me.Label8.Text = "Day"
'
'TextBox6
'
Me.TextBox6.Location = New System.Drawing.Point(427, 394)
Me.TextBox6.Name = "TextBox6"
Me.TextBox6.Size = New System.Drawing.Size(100, 20)
Me.TextBox6.TabIndex = 105
'
'Label9
'
Me.Label9.AutoSize = True
Me.Label9.Location = New System.Drawing.Point(588, 306)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(35, 13)
Me.Label9.TabIndex = 112
Me.Label9.Text = "Room"
'
'TextBox7
'
Me.TextBox7.Location = New System.Drawing.Point(678, 303)
Me.TextBox7.Name = "TextBox7"
Me.TextBox7.Size = New System.Drawing.Size(100, 20)
Me.TextBox7.TabIndex = 111
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(591, 435)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(94, 30)
Me.Button1.TabIndex = 113
Me.Button1.Text = "SUBMIT"
Me.Button1.UseVisualStyleBackColor = True
'
'TblteacherloadTableAdapter1
'
Me.TblteacherloadTableAdapter1.ClearBeforeFill = True
'
'TblteacherloadDataSet3
'
Me.TblteacherloadDataSet3.DataSetName = "tblteacherloadDataSet3"
Me.TblteacherloadDataSet3.SchemaSerializationMode = System.Data.SchemaSerializationMode.IncludeSchema
'
'BindingSource1
'
Me.BindingSource1.DataMember = "tblteacherload"
Me.BindingSource1.DataSource = Me.TblteacherloadDataSet3
'
'TblteacherloadTableAdapter2
'
Me.TblteacherloadTableAdapter2.ClearBeforeFill = True
'
'DataGridViewTextBoxColumn1
'
Me.DataGridViewTextBoxColumn1.DataPropertyName = "ID"
Me.DataGridViewTextBoxColumn1.HeaderText = "ID"
Me.DataGridViewTextBoxColumn1.Name = "DataGridViewTextBoxColumn1"
'
'NameDataGridViewTextBoxColumn
'
Me.NameDataGridViewTextBoxColumn.DataPropertyName = "Name"
Me.NameDataGridViewTextBoxColumn.HeaderText = "Name"
Me.NameDataGridViewTextBoxColumn.Name = "NameDataGridViewTextBoxColumn"
'
'DataGridViewTextBoxColumn2
'
Me.DataGridViewTextBoxColumn2.DataPropertyName = "Section"
Me.DataGridViewTextBoxColumn2.HeaderText = "Section"
Me.DataGridViewTextBoxColumn2.Name = "DataGridViewTextBoxColumn2"
'
'DataGridViewTextBoxColumn3
'
Me.DataGridViewTextBoxColumn3.DataPropertyName = "Subject"
Me.DataGridViewTextBoxColumn3.HeaderText = "Subject"
Me.DataGridViewTextBoxColumn3.Name = "DataGridViewTextBoxColumn3"
'
'DataGridViewTextBoxColumn4
'
Me.DataGridViewTextBoxColumn4.DataPropertyName = "Day"
Me.DataGridViewTextBoxColumn4.HeaderText = "Day"
Me.DataGridViewTextBoxColumn4.Name = "DataGridViewTextBoxColumn4"
'
'DataGridViewTextBoxColumn5
'
Me.DataGridViewTextBoxColumn5.DataPropertyName = "Time"
Me.DataGridViewTextBoxColumn5.HeaderText = "Time"
Me.DataGridViewTextBoxColumn5.Name = "DataGridViewTextBoxColumn5"
'
'DataGridViewTextBoxColumn6
'
Me.DataGridViewTextBoxColumn6.DataPropertyName = "Room"
Me.DataGridViewTextBoxColumn6.HeaderText = "Room"
Me.DataGridViewTextBoxColumn6.Name = "DataGridViewTextBoxColumn6"
'
'frmTeacherload
'
Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
Me.ClientSize = New System.Drawing.Size(839, 494)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.Label9)
Me.Controls.Add(Me.TextBox7)
Me.Controls.Add(Me.Label7)
Me.Controls.Add(Me.TextBox5)
Me.Controls.Add(Me.Label8)
Me.Controls.Add(Me.TextBox6)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.TextBox3)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.TextBox4)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.DataGridView2)
Me.Controls.Add(Me.Panel1)
Me.Controls.Add(Me.lblBack)
Me.Controls.Add(Me.ComboBox1)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.Name = "frmTeacherload"
Me.Text = "First Books Learning Center"
CType(Me.DataGridView2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TblteacherloadDataSet2, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TblteacherloadDataSet1, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.TblteacherloadDataSet3, System.ComponentModel.ISupportInitialize).EndInit()
CType(Me.BindingSource1, System.ComponentModel.ISupportInitialize).EndInit()
Me.ResumeLayout(False)
Me.PerformLayout()

End Sub
Friend WithEvents frmTeacherload As System.Windows.Forms.Form
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents Label2 As System.Windows.Forms.Label
Friend WithEvents ComboBox1 As System.Windows.Forms.ComboBox
Friend WithEvents lblBack As System.Windows.Forms.LinkLabel
Friend WithEvents Panel1 As System.Windows.Forms.Panel
Friend WithEvents DataGridView2 As System.Windows.Forms.DataGridView
Friend WithEvents TblteacherloadDataSet1 As WindowsApplication1.tblteacherloadDataSet1
Friend WithEvents TblteacherloadBindingSource As System.Windows.Forms.BindingSource
Friend WithEvents TblteacherloadTableAdapter As WindowsApplication1.tblteacherloadDataSet1TableAdapters.tblteacherloadTableAdapter
Friend WithEvents TextBox1 As System.Windows.Forms.TextBox
Friend WithEvents Label3 As System.Windows.Forms.Label
Friend WithEvents Label4 As System.Windows.Forms.Label
Friend WithEvents TextBox2 As System.Windows.Forms.TextBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents TextBox3 As System.Windows.Forms.TextBox
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents TextBox4 As System.Windows.Forms.TextBox
Friend WithEvents Label7 As System.Windows.Forms.Label
Friend WithEvents TextBox5 As System.Windows.Forms.TextBox
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents TextBox6 As System.Windows.Forms.TextBox
Friend WithEvents Label9 As System.Windows.Forms.Label
Friend WithEvents TextBox7 As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents TblteacherloadDataSet2 As WindowsApplication1.tblteacherloadDataSet2
Friend WithEvents TblteacherloadBindingSource1 As System.Windows.Forms.BindingSource
Friend WithEvents TblteacherloadTableAdapter1 As WindowsApplication1.tblteacherloadDataSet2TableAdapters.tblteacherloadTableAdapter
Friend WithEvents IDDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
Shadows WithEvents Name As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents SectionDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents SubjectDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents DayDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents TimeDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents RoomDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents TblteacherloadDataSet3 As WindowsApplication1.tblteacherloadDataSet3
Friend WithEvents BindingSource1 As System.Windows.Forms.BindingSource
Friend WithEvents TblteacherloadTableAdapter2 As WindowsApplication1.tblteacherloadDataSet3TableAdapters.tblteacherloadTableAdapter
Friend WithEvents DataGridViewTextBoxColumn1 As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents NameDataGridViewTextBoxColumn As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn2 As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn3 As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn4 As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn5 As System.Windows.Forms.DataGridViewTextBoxColumn
Friend WithEvents DataGridViewTextBoxColumn6 As System.Windows.Forms.DataGridViewTextBoxColumn

下课

frmTeacherload

Public Class frmTeacherload
Dim query As String
Dim y As String = "Provider=Microsoft.ACE.OLEDB.12.0;Password='';User ID=;Data Source='" & Application.StartupPath & "/tblteacherload.accdb';"
Dim database As New clsDatabase.OleDBase(y)
Private Sub lblBack_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs) Handles lblBack.LinkClicked
frmEnrollment.Show()
Me.Hide()
End Sub

Private Sub frmTeacherload_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'TblteacherloadDataSet3.tblteacherload' table. You can move, or remove it, as needed.
Me.TblteacherloadTableAdapter2.Fill(Me.TblteacherloadDataSet3.tblteacherload)
'TODO: This line of code loads data into the 'TblteacherloadDataSet2.tblteacherload' table. You can move, or remove it, as needed.
Me.TblteacherloadTableAdapter1.Fill(Me.TblteacherloadDataSet2.tblteacherload)
'TODO: This line of code loads data into the 'TblteacherloadDataSet1.tblteacherload' table. You can move, or remove it, as needed.
Me.TblteacherloadTableAdapter.Fill(Me.TblteacherloadDataSet1.tblteacherload)

End Sub

Private Sub Label3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label3.Click

End Sub

Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged

End Sub
Private Sub fillDataGridView2()
Try
Cursor = Cursors.WaitCursor
'=================================================
'eto lang naman ung mahalaga-> para ilabas sa datagridview ung laman ng table
query = "Select * From tblteacherload;" ' malamang eto ung query
database.ToDataGrid(Me.DataGridView2, query) ' eto naman ung pang-execute
'=================================================
Cursor = Cursors.Default
Catch ex As Exception
MessageBox.Show("Connection Failed")
Cursor = Cursors.Default
End Try
End Sub

'eto ung mga query, dapat maayos at tama lahat ng nakasulat., pag hindi error lalabas, magingat ka sa pag-dedeclare, tignan mo mabuti ung query para tama
Private Sub add_save()
query = "INSERT INTO `tblteacherload`(`ID`, `Name`, `Section`, `Subject`, `Day`,`Time`,`Room`) VALUES ('" _
& TextBox1.Text & "', '" & TextBox2.Text & "', '" & TextBox3.Text & "', '" & TextBox4.Text & "', '" & TextBox5.Text & "', '" & TextBox6.Text & "', , '" & TextBox7.Text & "');"
database.ToDataGrid(Me.DataGridView2, query)
clear()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
add_save()
MsgBox("Saved Successfully", MsgBoxStyle.Information, "")
End Sub
Private Sub clear()
TextBox1.Clear()
TextBox2.Clear()
TextBox3.Clear()
TextBox4.Clear()
TextBox5.Clear()
TextBox6.Clear()
TextBox7.Clear()

End Sub

Private Sub FillByToolStripButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Try
Me.TblteacherloadTableAdapter1.FillBy(Me.TblteacherloadDataSet2.tblteacherload)
Catch ex As System.Exception
System.Windows.Forms.MessageBox.Show(ex.Message)
End Try

End Sub
End Class

最佳答案

错误在这一行

Me.Name = New System.Windows.Forms.DataGridViewTextBoxColumn()

您的 DataGridView 控件上有一个名为“Name”的列,并且表单有一个名为“Name”的属性。当设计人员找到上面的行时,它认为那是表单的属性名称。

如果您查看设计器代码,您会发现另一行

Me.Name = "frmTeacherload"

要修复该错误,您必须重命名该列。

关于VB.Net 设计器错误(类型 'String' 的值无法转换为 'System.Windows.Forms.DataGridViewTextBoxColumn' 。),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22431940/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com