VB6: s=App.EXEName VB.Net: Imports System.Reflection With New System.IO.FileInfo([Assembly].GetExecutingAssembly.Location) s=.Name.Substring(0, .Name.Length - .Extension.Length) End With or s=System.AppDomain.CurrentDomain.FriendlyName Note: this includes the extension which would need to be parsed.
VB6: App.OleRequestPendingMsgText App.OleRequestPendingMsgTitle App.OleRequestPendingTimeout App.OleServerBusyMsgText App.OleServerBusyMsgTitle App.OleServerBusyRaiseError App.OleServerBusyTimeout VB.Net: No replacement; OLE automation not supported
VB6: s=App.Path VB.Net: s=System.Windows.Forms.Application.StartupPath or Imports System.Reflection With New System.IO.FileInfo([Assembly].GetExecutingAssembly.Location) s = .FullName.Substring(0, .FullName.Length - .Name.Length - 1) End With Note: this will return the path with no trailing backslash even if the application is in the root directory. The VB 6.0 App.Path method return included the trailing backslash when the executable was in a root directory.
http://www.uml.org.cn/net/net041809.htm
http://www.uml.org.cn/net/net041810.htm
比如在数据库,网络等等领域都是VB6无法比拟的。
VB.NET是真正面向对象的
VB6简单易学
VB.NET....个人觉得还是C#简单
添加用户要求的新功能。
使代码易于阅读和维护。
帮助程序员避免引入编码错误。
使应用程序更强大并更易于调试
Visual Basic .NET 2002 中的新增功能
Visual Basic .NET 2003 还包括在 Visual Basic .NET 2002 中新增的以下功能。 继承
Visual Basic .NET 通过允许定义作为派生类基础的类支持“继承”。派生类继承并可以扩展基类的属性和方法。它们还可以用新实现重写继承方法。默认情况下,用 Visual Basic .NET 创建的所有类都是可继承的。由于您设计的窗体实际上是类,因此可以使用继承基于现有窗体来定义新的窗体。有关详细信息,请参见继承。
异常处理
Visual Basic .NET 通过使用增强版本的 Try...Catch...Finally 语法支持“结构化异常处理”,诸如 C++ 之类的其他语言也支持该语法。结构化异常处理将现代控件结构(类似于 Select Case 或 While)与异常、受保护的代码块和筛选器结合起来。结构化异常处理使用可靠、综合的错误处理程序使创建和维护程序变得容易。有关详细信息,请参见异常处理。
重载
“重载”是定义同名但使用不同数据类型的属性、方法或过程的能力。利用重载过程可以根据需要提供足够多的实现来处理不同类型的数据,而表面看来只是一个通用过程。有关详细信息,请参见重载属性和方法。
重写属性和方法
Overrides 关键字可使派生对象重写从父级对象继承的特征。重写的成员具有与基类派生的成员相同的参数,但实现不同。成员的新实现可以通过成员名称前加 MyBase 调用父类中的原始实现。有关详细信息,请参见重写属性和方法。
构造函数和析构函数
“构造函数”是控制类的新实例初始化的过程。反过来,“析构函数”是当类离开范围或设置为 Nothing 时释放系统资源的方法。Visual Basic .NET 通过 Sub New 和 Sub Finalize 过程支持构造函数和析构函数。有关详细信息,请参见对象生存期:如何创建和销毁对象。
数据类型
Visual Basic .NET 引入了三种新的数据类型。Char 数据类型是一个无符号的 16 位数量,用来存储 Unicode 字符。它等效于 .NET Framework 的 System.Char 数据类型。Short 数据类型是有符号的 16 位整数,在 Visual Basic 的以前版本中称为 Integer。Decimal 数据类型是 96 位有符号的整数乘以 10 的可变次数幂。在 Visual Basic 的早期版本中,该数据类型仅在 Variant 中可用。有关详细信息,请参见数据类型。
接口
“接口”描述类的属性和方法,但和类不同,它不提供实现。Interface 语句可以声明接口,而 Implements 语句允许编写代码可以实现接口中描述的项。有关详细信息,请参见 Visual Basic .NET 中的接口。
委托
“委托”是代表您自己调用对象方法的对象,有时被描述为类型安全、面向对象的函数指针。可以使用委托让过程指定事件处理程序方法在事件发生时运行。也可以将委托用于多线程应用程序。有关详细信息,请参见委托和 AddressOf 运算符。
共享成员
共享成员是由一个类的所有实例共享的属性、过程和字段。当多个对象需要使用公共信息时,共享数据成员很有用。可以直接使用共享类方法,而无需首先从类创建对象。有关详细信息,请参见共享成员。
引用
“引用”允许使用其他程序集中定义的对象。在 Visual Basic .NET 中,引用指向程序集,而非类型库。有关详细信息,请参见引用和 Imports 语句。
命名空间
“命名空间”通过按照层次结构组织类、接口和方法来避免命名冲突。有关详细信息,请参见命名空间。
程序集
“程序集”通过描述特定组件或应用程序的所有必需文件来替换和扩展类型库的能力。一个程序集可以包含一个或多个命名空间。有关详细信息,请参见程序集。
特性
“特性”可以提供有关程序元素的其他信息。例如,将类用作 XML Web service 时,可以使用特性来指定应公开类中的哪个方法。有关详细信息,请参见特性。
多线程编程
Visual Basic .NET 允许编写独立执行多任务的应用程序。有可能延迟其他任务的任务可在单独的线程上执行,该过程称为“多线程处理”。通过使复杂任务在独立于用户接口的线程中运行,多线程处理提高了应用程序对用户输入的响应能力。有关详细信息,请参见多线程应用程序。
创建多层应用程序相当方便.
Q : VB6 to VB.Net 几个转换速查(大家来补充吧,送分)
主要解答者: Latitude 提交人: Latitude
感谢: caicai8034、sumtec、landog
审核者: Latitude 论坛对应贴子: 查看
A : VB6
VB.NET
-----------------------------------------------------
DoEvents
System.Windows.Forms.Application.DoEvents()
Command1.BackColor = vbRed
Command1.BackColor = System.Drawing.Color.Red
Command1.BackColor = System.Drawing.Color.FromARGB(&H80C0FF)
ComboBox1.AddItem "one"
ComboBox1.Items.Add("one")
Command1.BackColor = &H80C0FF
Command1.BackColor = System.Drawing.ColorTranslator.FromOle(&H80C0FF&)
Form1.Caption = "Sample"
Form1.DefInstance.Text = "Sample"
Form1.Top
Form1.DefInstance.Top
MsgBox "message", vbInformation, "title"
MsgBox("message", MsgBoxStyle.Information, "title")
Form1.Height = 3500
Form1.DefInstance.Height = VB6.TwipsToPixelsY(3500)
Set MyObject = Command1
MyObject = Command1
Text1.SetFocus
Text1.Focus()
Command1.ToolTipText = "click me"
ToolTip1.SetToolTip(Command1, "click me")
Dim objAbout As AboutForm
Dim objAbout As Pharfruminsain_AboutForm_v1r0.AboutForm
sPath = App.Path
sPath = Application.StartupPath
Private Sub Form_Unload(Cancel As Integer)
Private Sub Form1_Closed(....) Handles MyBase.Closed
List1.RemoveItem (0)
ListBox1.Items.Remove(0)
Dim arOne(10) As String
Dim arOne As New ArrayList(10)
Print #1, "sample text"
PrintLine(1, "sample text")
Open "c:\myfile.txt" For Input As #1
FileOpen(1, "c:\myfile.txt", OpenMode.Input)
Line Input #1, sTemp
sTemp = LineInput(1)
VB6:
s=App.Comments
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
s=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).Comments
VB6:
s=App.CompanyName
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
s=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).CompanyName)
VB6:
s=App.EXEName
VB.Net:
Imports System.Reflection
With New System.IO.FileInfo([Assembly].GetExecutingAssembly.Location)
s=.Name.Substring(0, .Name.Length - .Extension.Length)
End With
or
s=System.AppDomain.CurrentDomain.FriendlyName
Note: this includes the extension which would need to be parsed.
VB6:
s=App.FileDescription
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
s=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).FileDescription)
VB6:
App.HelpFile
VB.Net:
No direct replacement
VB6:
i=App.hInstance
VB.Net:
Imports System.Runtime.InteropServices
i=Marshal.GetHINSTANCE([Assembly].GetExecutingAssembly.GetModules()(0)).ToInt32
VB6:
s=App.LegalCopyright
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
s=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).LegalCopyright)
VB6:
s=App.LegalTrades
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
s=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).LegalTrades)
VB6:
App.LogMode
App.LogPath
VB.Net:
No direct replacement; see the EventLog object
VB6:
i=App.Major
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
i=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).FileMajorPart)
VB6:
i=App.Minor
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
i=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).FileMinorPart)
VB6:
App.NonModalAllowed
VB.Net:
No replacement
VB6:
App.OleRequestPendingMsgText
App.OleRequestPendingMsgTitle
App.OleRequestPendingTimeout
App.OleServerBusyMsgText
App.OleServerBusyMsgTitle
App.OleServerBusyRaiseError
App.OleServerBusyTimeout
VB.Net:
No replacement; OLE automation not supported
VB6:
s=App.Path
VB.Net:
s=System.Windows.Forms.Application.StartupPath
or
Imports System.Reflection
With New System.IO.FileInfo([Assembly].GetExecutingAssembly.Location)
s = .FullName.Substring(0, .FullName.Length - .Name.Length - 1)
End With
Note: this will return the path with no trailing backslash even if the application is in the root directory. The VB 6.0 App.Path method return included the trailing backslash when the executable was in a root directory.
VB6:
b=App.PrevInstance
VB.Net:
Imports System.Diagnostics
b=(UBound(Process.GetProcessesByName(Process.GetCurrentProcess.ProcessName)) > 0)
VB6:
s=App.ProductName
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
s=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).ProductName)
VB6:
App.RetainedProject
VB.Net:
No replacement; state not supported
VB6:
i=App.Revision
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
i=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).FileBuildPart)
and/or:
i=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).FilePrivatePart)
VB6:
App.StartMode
VB.Net:
No direct replacement
VB6:
App.TaskVisible
VB.Net:
No direct replacement
VB6:
App.ThreadID
VB.Net:
No direct replacement; see the System.Threading.Thread object
VB6:
App.Title
VB.Net:
The Text (caption) of the top-level form. If there are no forms then the process does not appear in Task Manager.
VB6:
App.UnattendedApp
VB.Net:
No direct replacement
Methods:
VB6:
App.StartLogging
App.LogEvent
VB.Net:
No direct replacement; see the EventLog object
先要定义一下
dim pass as new form
首先一看还以为VB.NET 是网络编程用的 看样子错了!~