【发布时间】:2020-04-08 13:35:31
【问题描述】:
在执行我的代码期间,我正在显示一个包含 gif 照片的图片框:
Me.PicLoading.Visible = True
Call xCLS.MyCodes_GetID("tbl_cities", Me.t1)
Me.PicLoading.Visible = False
这工作得很好,但是当我使用长“For Loop”的长过程时,PictureBox 框变得隐藏,并且在执行循环后图像框变得可见。 这个问题只发生在循环中。
接下来的代码是循环:
Public Sub MyCodes_GetID(ByVal TblName As String, ByVal TxT As TextBox)
Dim xCount, i As Integer
Dim xDtCount As DataTable = New DataTable()
MyCodes_Fill_DataTable("Select ID From " & TblName & " Order By ID", xDtCount)
xCount = Convert.ToInt32(xDtCount.Rows.Count)
For i = 1 To xCount
Dim xCountID As Byte
Dim xDtCountID As DataTable = New DataTable()
MyCodes_Fill_DataTable("Select ID From " & TblName & " Where ID = " & i & "", xDtCountID)
xCountID = Convert.ToInt32(xDtCountID.Rows.Count)
If xCountID = 0 Then
GoTo Line1
End If
Next
Line1:
TxT.Text = CStr(i)
End Sub
任何cmets
【问题讨论】:
-
在循环中,你没有对图片框做任何事情。你可能应该用
Exit For替换那个GoTo语句。 -
@preciousbetine 我知道,我试过
Exit For,得到了同样的结果 -
@preciousbetine 我直接从属性设置图像而不是通过代码