ICANN认证国际域名顶级注册机构
网站建设,域名注册,空间租用,软件销售,广告设计 域名注册,空间租用, 网站建设,东莞网页设计,域名注册,网站推广,网站开发,网页设计 网站推广,,百度推广,新浪推广,雅虎推广,网易推广 标志设计,画册设计,包装设计,VI策划,企业形象顾问 连邦软件加盟店,提供销遥行,管家婆,速达,用友ERP,诺顿等软件报价及销售 建站必读 腾达网络,上网帮助中心, 腾达为东莞等地,提供网站建设,网站推广,广告设计,软件销售等优质服务!
建站必读


 
 
当前位置:首页 -> 建站必读 -> .NET技术
Retrieving Environmental Details using VB.NET
Windows based application would generally have requirement to access the Windows System Directory Path, Current Directory , Windows directory or to retrieve the Current Computer name,UserName, DomainName, OSVersion etc. Retrieving these information required API Calls in VB6.



VB.NET removes the complexity of calling API to access such useful information by providing the class library Environment as part of .NET. As known to all of us, the class library is accessible to all the .NET languages.



Here is an example that retrieves the above information using VB.NET.



1) Place a button in the form

2) Place a TextBox in the Form and name it as txtInfo

3) Set the Multi-line property of the TextBox(txtInfo) to True

4) Import the System.Environment namespace

5) Write the following code in the CommandButton click Event



        Dim s As String

        Dim o As System.Environment



        s = "Current Directory=System.Environment.CurrentDirectory()->"

        s = s & o.CurrentDirectory() & vbCrLf



        s = s & "CommandLine=System.Environment.CommandLine()->"

        s = s & o.CommandLine() & vbCrLf



        s = s & "Environment Variable=System.Environment.GetEnvironmentVariable(variable)->"

        s = s & o.GetEnvironmentVariable("PATH") & vbCrLf



        s = s & "MachineName=System.Environment.MachineName->"

        s = s & o.MachineName & vbCrLf



        s = s & "SystemDirectory=System.Environment.SystemDirectory->"

        s = s & o.SystemDirectory & vbCrLf



        s = s & "UserName=System.Environment.UserName->"

        s = s & o.UserName & vbCrLf



        s = s & "UserDomainName=System.Environment.UserDomainName->"

        s = s & o.UserDomainName & vbCrLf



        s = s & "OSVersion=System.Environment.OSVersion->"

        s = s & o.OSVersion.ToString & vbCrLf



  txtInfo.Text = s



The namespace System.Environment provides methods  to access various information like System Name, Domain Name , Username, OSVersion etc. These methods returns a string as a parameter. Values are retrieved and stored in the local variable s. To avoid using a length qualifier System.Environment with each call, a varaible is declared of type System.Environment and the same is substituted there.



When the button is pressed, all the above information  are retrieved and posted in the Textbox txtInfo.



Happy programming with VB.NET.


 
 
本站关键词:
|东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇||东莞网站开发|东莞企业网站建设|国际内域名注册|石龙 虎门 中堂|望牛墩 麻涌镇 石碣镇|高埗镇 洪梅镇 道滘镇|厚街镇 沙田镇 长安镇| 寮步镇 大岭山 大朗諀 黄江镇 樟木头 凤岗諀 塘厦镇 谢岗镇 清溪諀常平镇 桥头镇 横沥镇|东坑镇 企石镇 石排镇|
域名注册 | 虚拟主机 | 网站建设 | 网站推广 | 广告设计 | 帮助中心 | 软件中心 | 关于腾达
东莞市腾达信息工程有限公司      本站网络实名: 东莞网站建设
地址:东莞市新城市中心区第一国际B座610   邮编:523007
电话:0769-22026071 22026072 传真:0769-22026076 24小时服务热线:13712032014
© 2002~2005 腾达网络   版权所有