[C #] [WinForm] using VB Controls in C # FileListBox

In recent VB system to help customers to C # version of
the record about how to use C # VB in the FileListBox control


Recently helping customers to VB to C # system version

Record how to use VB Controls in C # FileListBox


VS VB first added in the toolbox FileListBox control, as shown in FIG.

Then pull to the form in FileListBox

The main function of this control is to set a path to the directory, and then displays all the files in this directory controls in


C # program:

using System;
using System.Windows.Forms;

namespace WinFormCSharp
{
    public partial class FrmFileListBox : Form
    {
        public FrmFileListBox()
        {
            InitializeComponent();
        }

        private void FrmFileListBox_Load(object sender, EventArgs e)
        {
            fileListBox1.Path = @"c:puma";//指定路径
        }

        private void btnRefresh_Click(object sender, EventArgs e)
        {
            fileListBox1.Refresh();//更新FileListBox的项目
        }

        private void btnShowItem_Click(object sender, EventArgs e)
        {
            foreach (string item in fileListBox1.Items) // reading out all files in the specified path 
            { 
                MessageBox.Show (Item); 
            } 
        } 
    } 
}

Results of the:


Original: Large column  [C #] [WinForm] using VB Controls in C # FileListBox


Guess you like

Origin www.cnblogs.com/chinatrump/p/11490916.html