gpt4 book ai didi

vb.net - 如何在 vb.net 中将后期绑定(bind)语法转换为早期绑定(bind)语法?

转载 作者:行者123 更新时间:2023-12-03 08:04:40 26 4
gpt4 key购买 nike

我有这个代码:

 Private Sub frmMain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Try
' retrieving the administration table.
con.Open()
DataAdapter1.SelectCommand = sqladmin
DataAdapter1.Fill(ds, "stratos")
DataGridView1.DataSource = ds
DataGridView1.DataMember = "stratos"
con.Close()
Catch myerror As MySqlException
MessageBox.Show("Error Retrieving Administration Table: " & myerror.Message)
End Try


Try
' retrieving the projects list.
con.Open()
DataAdapter2.SelectCommand = sqlprojects
DataAdapter2.Fill(ds2, "projects")
ListBox1.Items.Clear()

For Each DataRow In ds2.Tables("projects").Rows

' ##### THE ERROR OCCURS ON THE LINE BELOW: ##### '

ListBox1.Items.Add(DataRow("project_name"))
Next
con.Close()

Catch myerror As MySqlException
MessageBox.Show("Error Retrieving Projects List: " & myerror.Message)
End Try

我收到以下错误:

Error 1: Option Strict On disallows late binding.



我在运行 Windows 7 操作系统的网关笔记本电脑上使用 Visual Basic 2010 Express
我该如何解决这个错误?

最佳答案

您需要将错误的循环更改为以下内容:

For Each dr as DataRow In ds2.Tables("projects").Rows 

' ##### THE ERROR OCCURS ON THE LINE BELOW: ##### '

ListBox1.Items.Add(Convert.ToString(dr("project_name")))
Next

关于vb.net - 如何在 vb.net 中将后期绑定(bind)语法转换为早期绑定(bind)语法?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7302935/

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