C # Wonderful choice of Microsoft. VisualBasic My object landline [original month]

Source: Internet
Author: User

C # Wonderful choice for Microsoft. VisualBasic My object

Author: qingyueer

Home page:Http://blog.csdn.net/21aspnet/Time: 2007.4.24

1. Add reference

2. reference the Microsoft. VisualBasic namespace

3. All My object applications come from the following class libraries. This article is only for reference. For more information, see MSDN.

4. Application-get information about the server where the application is located

Note: You need to add using Microsoft. VisualBasic. Devices;
Code
Using System;
Using System. Data;
Using System. Configuration;
Using System. Web;
Using System. Web. Security;
Using System. Web. UI;
Using System. Web. UI. WebControls;
Using System. Web. UI. WebControls. WebParts;
Using System. Web. UI. HtmlControls;
Using Microsoft. VisualBasic. Devices;
Public partial class _ Default: System. Web. UI. Page
{
Protected void Page_Load (object sender, EventArgs e)
{

}

Protected void Button1_Click1 (object sender, EventArgs e)
{
Microsoft. VisualBasic. Devices. Computer my = new Computer ();
TextBox1.Text = "machine Name:" + my. Name + "/r/n ";
TextBox1.Text + = "Operating System Information:" + my. info. OSFullName + "" + my. info. OSPlatform + "" + my. info. OSVersion + "/r/n ";
TextBox1.Text + = "physical memory:" + my. Info. TotalPhysicalMemory + "/r/n ";
TextBox1.Text + = "virtual memory:" + my. Info. TotalVirtualMemory + "/r/n ";
TextBox1.Text + = "available physical memory:" + my. Info. AvailablePhysicalMemory + "/r/n ";
TextBox1.Text + = "available virtual memory:" + my. Info. AvailableVirtualMemory + "/r/n ";}
}

5. File Operations

Code:
Using System;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Using Microsoft. VisualBasic. Devices;
Using System. Text;
Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{

}

Protected void button1_click1 (Object sender, eventargs E)
{
Microsoft. VisualBasic. Devices. Computer my = new Microsoft. VisualBasic. Devices. Computer ();
TextBox1.Text = my. FileSystem. ReadAllText (FileUpload1.PostedFile. FileName, Encoding. GetEncoding ("gb2312 "));

}
}

6. Read the system registry (this is the roughest read. We recommend that you use recursion + tree menu to display all)

Code
Using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Using Microsoft. VisualBasic. devices;
Using system. text;

Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{

}


Protected void button#click (Object sender, eventargs E)
{
Microsoft. VisualBasic. devices. Computer my = new Microsoft. VisualBasic. devices. Computer ();
Foreach (string K in my. Registry. currentuser. getsubkeynames ())
{
Textbox1.text + = K + "/R/N ";
}

}
}

YesAfter registry, click classesroot, localmachine, and other nodes.

7. Microsoft. VisualBasicTheString processing capabilityVery powerful.
The most common half-width and full-width swaps, simplified and Traditional Interchange, and so on are very easy to do. Since they can be so easy to handle, why do we need to write complex classes?

Code:

Using system;
Using system. Data;
Using system. configuration;
Using system. Web;
Using system. Web. Security;
Using system. Web. UI;
Using system. Web. UI. webcontrols;
Using system. Web. UI. webcontrols. webparts;
Using system. Web. UI. htmlcontrols;
Using Microsoft. VisualBasic;
Using system. text;

Public partial class _ default: system. Web. UI. Page
{
Protected void page_load (Object sender, eventargs E)
{

}


Protected void button#click (Object sender, eventargs E)
{
Textbox2.text = strings. strconv (textbox1.text,Vbstrconv. Narrow, 0 );
TextBox4.Text = Strings. StrConv (TextBox3.Text,Vbstrconv. traditionalchinese, 0 );

}
}

Vbstrconv. None

Do not perform any conversion

VbStrConv. LinguisticCasing

Use language rules for Case sensitivity instead of file systems (default ). It is valid only when used together with VbStrConv. UpperCase and VbStrConv. LowerCase.

VbStrConv. UpperCase

Converts a string to uppercase.

VbStrConv. LowerCase

Converts a string to lowercase characters.

VbStrConv. ProperCase

Converts the first letter of each word in a string to uppercase.

VbStrConv. Wide *

Converts the narrow (half-width) character in a string to the wide (full-width) character.

VbStrConv. Narrow *

Converts the width (full) character in a string to a narrow (half-width) character.

VbStrConv. Katakana **

Converts a hirakana character in a string to a katakana character.

VbStrConv. Hiragana **

Converts a katakana character in a string to a hirakana character.

VbStrConv. SimplifiedChinese *

Converts traditional Chinese characters to simplified Chinese characters.

VbStrConv. TraditionalChinese *

Converts a simplified Chinese character to a traditional Chinese character.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.