Some small things, leave a backup (C #)

zhaozj2021-02-16  68

1. Use IE in WinForm: Right-click on the Toolbox, select the Add / Delete Option, select the COM Component tab in the pop-up dialog box, find the Microsof web browser component, determine, select the webbrowser control in the Toolbox, Drag and drop on to the form, then write code: private void button1_click (object sender, system.eventargs e) {? String str = "" system.Object nullobject = 0; system.Object nullobjstr = str; this. AxWebBrowser1.navigate ("www.9cbs.net", ref nullobject, ref nullobjstr, ref nullobjstr, ref nullobjstr); ???} 2. Modify the XML node value: Set XML documentation:

Server

XMLDocument Doc = new xmldocument (); doc.load ("sample.xml"); xmlnodelist nodes = doc.getElementsBytagname ("name"); nodes [0] .innertext = "newValue"; doc.save ("Sample.xml "); 3. Write the log file when the class is destructed: use system; use system.io; use system.data; namespace finalize {? Class test? {?? string s =" aaa "; ?? ~ Test () ?? {??? lastgasp = file.createtext ("YourLog.Log"); ??? Lastgasp.writeline ("IT's a log" s); ??? Lastgasp. Lastgasp.close (); ??}

?? [stathread] ?? static void main (string [] args) ?? {??? test t = new test (); ??}?}}

转载请注明原文地址:https://www.9cbs.com/read-14668.html

New Post(0)