Bu cevap, konu sahibi tarafından kabul edilebilir bir cevap olarak işaretlendi.
hocam amacım textboxda yazan yolu resmi aktar dediğimde acılan openfiledialogta kendi yolu yazıp enterlaması
Thread t;
private const string initialDir = "C:\\";
private const string FileName = "aa.jpg";
private void button1_Click(object sender, EventArgs e)
{
string combinedDir = initialDir + FileName;
if (File.Exists(combinedDir))
{
openFileDialog1.InitialDirectory = initialDir;
openFileDialog1.FileName = FileName;
BeginInvoke((Action)(() => openFileDialog1.ShowDialog()));
t = new Thread(new ThreadStart(SendKey));
t.Start(); // Thread starts.
}
else
{
openFileDialog1.InitialDirectory = initialDir;
openFileDialog1.FileName = FileName;
openFileDialog1.ShowDialog();
}
}
private void SendKey()
{
Thread.Sleep(100);
SendKeys.SendWait("+{TAB}");
SendKeys.SendWait("+{TAB}");
SendKeys.SendWait(FileName);
}