Sunday, March 09, 2008

โค้ด filter ตัว openfile dialog ของ c# และสั่งให้ os run programm ที่ assign อยู่กับ file type

ประมาณนี้ ง่ายๆ แต่หาตั้งนาน

OpenFileDialog of = new OpenFileDialog();
of.InitialDirectory = @"c:\";
of.Filter = "Wav Files (*.wav)*.wav";
of.FilterIndex = 2;
if (of.ShowDialog() == DialogResult.OK)
{
//szFileName = of.FileName;
System.Diagnostics.Process.Start(of.FileName, "");
}

วันหลังมาหาที่นี่ 555 จดไว้ๆ

No comments: