1.
String returnValue = Path.GetFileNameWithoutExtension(path);
2.
if (this.openFileDialog1.ShowDialog() == DialogResult.OK)
{
String returnValue = openFileDialog1.SafeFileName;
}
3.
use lastindexof(".") ,not indexof (".")
strFilePaht.Substring(path.LastIndexOf("\\") + 1, path.Length - 1 - path.LastIndexOf("\\"));
strFilePaht.Substring(path.LastIndexOf("."), path.Length - path.LastIndexOf("."));