OpenFileDialog fd = new OpenFileDialog(); fd.Filter="(*.jpg)|*.*| All Files(*.*)|*.*|(*.txt)|*.txt|(*.xml*.xml"; fd.FilterIndex = 1; fd.ShowDialog(); txt1.Text = fd.FileName;