2016-03-29 31 views
0

Form ile özel olarak hazırlanmış bir web sitesi içeren win form uygulaması geliştiriyorum. Int web tarayıcı nesnesini kullanıyorum, problemim var.webrowser nesnesinde giriş penceresine odaklanın pencereler form uygulaması

Uygulama çalıştırıldıktan sonra belirli giriş alanına odaklanmak istiyorum.

HTML kodu: Benim app

<button id="btn">Ok</button><input id="txt"> 

Ben kodu vardır:

public Form1() 
    { 
     InitializeComponent(); 
     webBrowser1.Navigate(@"c:\test\test.htm"); 
     webBrowser1.Document.GetElementById("txt").Focus();//Error here 
    } 

Ve ben yanlış yapıyorum System.NullReferenceException

olsun?

+0

Lütfen güncellenmiş cevaba bir göz atın –

cevap

0

Form ile özel olarak hazırlanmış bir web sitesi içeren win form uygulaması geliştiriyorum. Int web tarayıcı nesnesini kullanıyorum, problemim var.

Uygulama çalıştırıldıktan sonra belirli giriş alanına odaklanmak istiyorum.

HTML kodu: Benim app

<button id="btn">Ok</button><input id="txt"> 

Ben kodu vardır:

public Form1() 
    { 
     InitializeComponent(); 
     webBrowser1.Navigate(@"c:\test\test.htm"); 
     webBrowser1.Document.GetElementById("txt").Focus();//Error here 
    } 

Ve ben yanlış yapıyorum System.NullReferenceException

olsun?