为列表框运行For循环 [英] running a For loop for a listbox

查看:124
本文介绍了为列表框运行For循环的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想运行此for循环,但是它在声明path_
时给了我一个错误 对我做错了什么有帮助吗?

I would like to run this for loop but it is giving me an error where I am declaring path_
Any help on what I am doing wrong?

Dim i As Integer
        Dim path_ As String

        If ListBox1.Items.Count > 0 Then

            For i = 0 To ListBox1.Items.Count - 1
                  path_ = fname & "\" ListBox1.Items(i)
                ListBox1.SelectedIndex = i
                create_db_1(path_)
            Next
        End If

推荐答案

尝试更改
path_ = fname & "\" ListBox1.Items(i)

放入

path_ = fname & "\" & ListBox1.Items(i).ToString()


path_ = fname & "\" ListBox1.Items(i)
&符号在这里丢失.
只需添加并使用Convert.ToString().
path_ = fname & "\" ListBox1.Items(i)
The & symbol is missing here.
Just add it and use Convert.ToString().


这篇关于为列表框运行For循环的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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