I am try to get my path from SaveFileDialog
without my file name in order to create a DirectoryInfo
object
private void btnBrowseCapture_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialogBrowse2 = new SaveFileDialog();
saveFileDialogBrowse2.Filter = "Pcap file|*.pcap";
saveFileDialogBrowse2.Title = "Save an pcap File";
saveFileDialogBrowse2.ShowDialog();
if (saveFileDialogBrowse2.FileName != "")
{
string str = saveFileDialogBrowse2.FileName;
}
}
You can also use System.IO.Path.GetDirectoryName
for this purpose
System.IO.Path.GetDirectoryName(filePath)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With