在引用列表框项目时需要帮助 [英] need help in refershing a listbox items

查看:52
本文介绍了在引用列表框项目时需要帮助的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好



我写了以下内容并在listview中加载数据



 尝试 
ParentEntry.Path = WinNT:
对于 每个 childEntry ParentEntry.Children
选择 案例 childEntry。 SchemaClassName
Case Domain


SubParentEntry.Path = WinNT://& childEntry.Name
对于 每个 SubChildEntry SubParentEntry.Children

选择 案例 SubChildEntry.SchemaClassName
案例 计算机
LBox.Items.Add(SubChildEntry.Name)
结束 选择
< span class =code-keyword>下一步

结束 选择
下一步
Catch Excep 作为例外
MsgBox( 读取目录时出错
最后
ParentEntry = 没什么
结束 尝试





现在我想在此之后对此进行评论一定的时间间隔..请给我打电话怎么办..



谢谢

解决方案

谢谢这个链接

http:// www .vbdotnetforums.com / windows-forms / 39160-listbox-items-do-not-refresh.html [ ^ ]



 私有  Sub  Form1_Load( ByVal  sender  As  System。 Object  ByVal  e  As  System.EventArgs)句柄  MyBase  .Load 

ListBox1.Items.Add( 第一项
ListBox1.Items.Add( 第二项
ListBox1.Items.Add( 第三项
ListBox1.Items.Add( 第四项
ListBox1.SelectedIndex = 0

Timer1.Interval = 500
Timer1.Start()

结束 Sub

私有 Sub Timer1_Tick( ByVal 发​​件人作为系统。对象 ByVal e As System.EventArgs)句柄 Timer1.Tick

Dim i 作为 整数
i = ListBox1.SelectedIndex
i = i + 1
如果 i> ListBox1.Items.Count - 1 然后 i = 0
ListBox1.SelectedIndex = i

结束 Sub


Hi all

I wrote the below to and loading the data in listview

Try
          ParentEntry.Path = "WinNT:"
          For Each childEntry In ParentEntry.Children
              Select Case childEntry.SchemaClassName
                  Case "Domain"


                      SubParentEntry.Path = "WinNT://" & childEntry.Name
                      For Each SubChildEntry In SubParentEntry.Children

                          Select Case SubChildEntry.SchemaClassName
                              Case "Computer"
                                  LBox.Items.Add(SubChildEntry.Name)
                          End Select
                      Next

              End Select
          Next
      Catch Excep As Exception
          MsgBox("Error While Reading Directories")
      Finally
          ParentEntry = Nothing
      End Try



now i want to referesh this after a certain interval of time..please tel me how to do..

Thank you

解决方案

chek this link
http://www.vbdotnetforums.com/windows-forms/39160-listbox-items-do-not-refresh.html[^]

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

ListBox1.Items.Add("First Item")
ListBox1.Items.Add("Second Item")
ListBox1.Items.Add("Third Item")
ListBox1.Items.Add("Fourth Item")
ListBox1.SelectedIndex = 0

Timer1.Interval = 500
Timer1.Start()

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

Dim i As Integer
i = ListBox1.SelectedIndex
i = i + 1
If i > ListBox1.Items.Count - 1 Then i = 0
ListBox1.SelectedIndex = i

End Sub


这篇关于在引用列表框项目时需要帮助的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆