Migrando para o VB.NET parte 3
Tipo |
VB 6 |
VB.NET |
DoEvents |
DoEvents |
System.Windows.Forms.Application.DoEvents |
Instância da aplicação |
App.hInstance |
System.Runtime.InteropServices.Marshal.GetHINSTANCE _(System.Reflection.Assembly.GetExecutingAssembly.GetModules() _(0)).ToInt32() |
Carregar Imagem |
Picture1.Picture = LoadPicture(path) |
Dim img As Image = Image.FromFile(path) |
Carregar um ícone |
Me.Icon = LoadPicture(path) |
Dim ico As New Icon(path) |
App Object |
App.Path & App.EXEName |
System.Reflection.Assembly.GetExecutingAssembly.Location.ToString |
Ler a partir de um arquivo |
Open path For Input As #1 |
Dim fs As FileStream = File.Open(path,
FileMode.OpenOrCreate, _ FileAccess.Read) |
Escrever para um arquivo |
Open path For Output As #1 |
Dim fs As FileStream = File.Open(path,
FileMode.OpenOrCreate, _ |
Propriedades |
Private valor As String |
Public Property teste() Get teste = valor End Get Set(ByVal Value) valor = Value End Set End Property
|
Verificar instância anterior |
App.PrevInstance |
Function PrevInstance() As Boolean |
Declaração de Classes |
Uma nova classe fica em um arquivo separado que usa a extensão .cls se identifica pelo arquivo. Ex: Nome.cls |
No visual Basic .NET a classe é identificada pela declaração O código fica em arquivos com a extensão .vb. Ex: Nome.vb
|
Uso e Criação de Interfaces |
Interface Icliente |
Public Interface UmaInterface Public Class AClass Implements UmaInterface .... End Class
|