sddd1
Member
- Joined
- Jul 22, 2021
- Messages
- 14
- Programming Experience
- 1-3
First Of All I add Directory in Listbox, Like A Directory, B Directory. When User Click the item of ListBox ,Get the full path of Items in C#
Someone modify the code !
Thanks in Advance !
Someone modify the code !
Thanks in Advance !
C#:
BindingSource listboxsource = null;
public Form1()
{
InitializeComponent();
listboxsource = new BindingSource(Properties.Settings.Default.listboxitems, "");
someListbox.DataSource = listboxsource;
}
//Add Folder in Listbox
private void button57_Click(object sender, EventArgs e)
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
dialog.Description = "Please Select Folder";
if (dialog.ShowDialog() == DialogResult.OK)
{
string folderName = dialog.SelectedPath;
string s = Path.GetFileName(folderName);
listboxsource.Add(s);
Properties.Settings.Default.Save();
listboxsource = new BindingSource(Properties.Settings.Default.listboxitems, "");
someListbox.DataSource = listboxsource;
}
}
private void listBox5_SelectedIndexChanged(object sender, EventArgs e)
{
try
{
string fullname = Properties.Settings.Default.FullName;
Properties.Settings.Default.Save();
MessageBox.Show(fullname);
}
catch(Exception)
{ }
}
Last edited by a moderator: