Hi RanaAyaz,
Refer below sample code and modify it according to your need.
C#
private void button1_Click(object sender, EventArgs e)
{
folderBrowserDialog1.ShowDialog();
string path = folderBrowserDialog1.SelectedPath;
string[] files = Directory.GetFiles(path);
StringBuilder str = new StringBuilder();
foreach (string item in files)
{
string fileName = item.Split('\\')[item.Split('\\').Length - 1];
byte[] byteData = File.ReadAllBytes(item);
// Insert Code with FileName and ByteData comes here.
str.Append(fileName + Environment.NewLine);
}
lblFileNames.Text = str.ToString();
}
VB.Net
Private Sub button1_Click(sender As Object, e As EventArgs)
folderBrowserDialog1.ShowDialog()
Dim path As String = folderBrowserDialog1.SelectedPath
Dim files As String() = Directory.GetFiles(path)
Dim str As New StringBuilder()
For Each item As String In files
Dim fileName As String = item.Split("\"C)(item.Split("\"C).Length - 1)
Dim byteData As Byte() = File.ReadAllBytes(item)
' Insert Code with FileName and ByteData comes here.
str.Append(fileName + Environment.NewLine)
Next
lblFileNames.Text = str.ToString()
End Sub