加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

*、VB.net 和 VB6 在一些方法上的转换技巧

发布时间:2020-12-17 08:20:27 所属栏目:百科 来源:网络整理
导读: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") Co

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.LegalTrademarks
VB.Net:
Imports System.Diagnostics
Imports System.Reflection
s=FileVersionInfo.GetVersionInfo([Assembly].GetExecutingAssembly.Location).LegalTrademarks)

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.Reflecti

VB6:

command1.value=True

VB.net:

1、在自定义过程中:Button1_Click(Nothing,Nothing)

2、在事件过程中:Button1_Click(sender,e)

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读