payne 0 Raportează post Postat Decembrie 28, 2008 Deci am facut un webbrowser in C#... nu e cine stie ce ...dar mam blocat undeva..... Am facut un dialog in care sa setezi homepage, dar am o mica problema, in acest dialog am un buton numit get current care teoretic ar trebui sa imi ia pagina actuala din webbrowser si sa o puna intrun textbox numit textBox1 Si am facut ceva de genu 1. Am facut controlul de la web browserul public.. 2. Am facut text boxul din dialogul unde setez homeul public. 3. Am facut buttonul Get Current Public 4. Asta e codul de la butonul pe care trebuie sa apesi ca sa itzi apara dialogul unde setezi home private void setHomeToolStripMenuItem_Click_1(object sender, EventArgs e) { string getcurrent = webBrowser1.Document.Url.ToString(); home hmPg = new home(); hmPg.Show(); } 5. Asta e codul de la butonul care ar trebui sa ia pagina actuala si sa o puna in textbox private void button3_Click(object sender, EventArgs e) { Form1 frm = new Form1(); WebBrowser wbs = frm.webBrowser1; textBox1.Text = wbs.Url.ToString(); } In cazul de mai sus am o eroare de genu Object reference not set to an instance of an object Cu aceste detalii See the end of this message for details on invoking just-in-time (JIT) debugging instead of this dialog box. ************** Exception Text ************** System.NullReferenceException: Object reference not set to an instance of an object. at WindowsFormsApplication1.home.button3_Click(Object sender, EventArgs e) in I:\312\WindowsFormsApplication1\home.cs:line 42 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) ************** Loaded Assemblies ************** mscorlib Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///c:/WINDOWS/Microsoft.NET/Framework/v2.0.50727/mscorlib.dll ---------------------------------------- Payne Browser Assembly Version: 1.0.0.0 Win32 Version: 1.0.0.0 CodeBase: file:///I:/312/WindowsFormsApplication1/bin/Release/Payne%20Browser.exe ---------------------------------------- System.Windows.Forms Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Windows.Forms/2.0.0.0__b77a5c561934e089/System.Windows.Forms.dll ---------------------------------------- System Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System/2.0.0.0__b77a5c561934e089/System.dll ---------------------------------------- System.Drawing Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Drawing/2.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll ---------------------------------------- System.Configuration Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Configuration/2.0.0.0__b03f5f7f11d50a3a/System.Configuration.dll ---------------------------------------- System.Xml Assembly Version: 2.0.0.0 Win32 Version: 2.0.50727.3053 (netfxsp.050727-3000) CodeBase: file:///C:/WINDOWS/assembly/GAC_MSIL/System.Xml/2.0.0.0__b77a5c561934e089/System.Xml.dll ---------------------------------------- Microsoft.mshtml Assembly Version: 7.0.3300.0 Win32 Version: 7.0.3300.0 CodeBase: file:///C:/WINDOWS/assembly/GAC/Microsoft.mshtml/7.0.3300.0__b03f5f7f11d50a3a/Microsoft.mshtml.dll ---------------------------------------- ************** JIT Debugging ************** To enable just-in-time (JIT) debugging, the .config file for this application or computer (machine.config) must have the jitDebugging value set in the system.windows.forms section. The application must also be compiled with debugging enabled. For example: <configuration> <system.windows.forms jitDebugging="true" /> </configuration> When JIT debugging is enabled, any unhandled exception will be sent to the JIT debugger registered on the computer rather than be handled by this dialog box. In caz ca schimb codul din punctul 5 cu acesta private void button3_Click(object sender, EventArgs e) { Form1 frm = new Form1(); WebBrowser wbs = frm.webBrowser1; textBox1.Text = wbs.Document.Url.ToString(); } Imi ia homepageul deja stabilit si il pune in Textbox Idei? Foto aici Sarbatori fericite.. Partajează acest post Link spre post Distribuie pe alte site-uri
payne 0 Raportează post Postat Decembrie 28, 2008 Close Topic.....Rezolvat.... Partajează acest post Link spre post Distribuie pe alte site-uri