主题:保护级别而无法访问
大家好,我是一个VB自学初学者(Visual basic 2010入门经典),在学习到Loop时,试运行程序时,出现错误:未声明ClearList,它可能因其保护级别而无法访问。
请问一下,错误怎么解决??
谢谢!!!
1、新建立一个名为Loops的Windows forms application
2、在出现的窗体中添加一个ListBox控件和一个Button控件
3、列表框控件的Name属性为lstData,IntegraHeigh为False
4、按钮Name属性为btnForNextLoop,Text为For Next Loop
5、程序如下:
Public Class Form1
Private Sub btnForNextLoop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForNextLoop.Click
'Declare variable
Dim intCount As Integer
'Clear the list
ClearList()
'Perform a loop
For intCount = 1 To 5
'Add the item to the list
lstDate.Items.Add ("I'm item"&intCount.ToString &"in the list")
Next
End Sub
Private Sub lstDate_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstDate.SelectedIndexChanged
'Clear the list
lstDate.Items.Clear()
End Sub
End Class
请问一下,错误怎么解决??
谢谢!!!
1、新建立一个名为Loops的Windows forms application
2、在出现的窗体中添加一个ListBox控件和一个Button控件
3、列表框控件的Name属性为lstData,IntegraHeigh为False
4、按钮Name属性为btnForNextLoop,Text为For Next Loop
5、程序如下:
Public Class Form1
Private Sub btnForNextLoop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnForNextLoop.Click
'Declare variable
Dim intCount As Integer
'Clear the list
ClearList()
'Perform a loop
For intCount = 1 To 5
'Add the item to the list
lstDate.Items.Add ("I'm item"&intCount.ToString &"in the list")
Next
End Sub
Private Sub lstDate_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles lstDate.SelectedIndexChanged
'Clear the list
lstDate.Items.Clear()
End Sub
End Class