App.Path

VB6

    App.Path

VB.net

    Application.StartupPath

DoEvents

VB6

    DoEvents

VB.net

    Application.DoEvents()

Left$, Mid$, Right$

VB6

    Left$(MaChaine,2)
    Mid$(MaChaine,2,5)
    Right$(MaChaine,2)

VB.net

    MaChaine.Substring(0,2)
    MaChaine.Substring(1,5)
    MaChaine.Substring(MaChaine.Length-2)

Screen.mousepointer

VB6

    Screen.MousePointer = 0

VB.net

    Cursor = Cursors.Default

SelStart, SelLength

VB6

    MyControl.SetFocus
    MyControl.SelStart=0
    MyControl.SelLength=len(MyControl.Text)

VB.net

    MyControl.Select()
    MyControl.SelectionStart = 0
    MyControl.SelectionLength = ComRef.Text.Length

SetFocus

VB6

    MyControl.SetFocus

VB.net

    MyControl.Select()

KeyAscii

VB6

Sub textbox1_keypress
    If keyascii = 13 then
        ……………………
    End if
End Sub

VB.net

1ère solution:

Sub textbox1_keypress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
    If e.KeyChar = vbCr Then
        ……………………
    End if
End Sub

2ème solution:

Sub TextBox1_KeyUp(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyUp
    If e.KeyCode = Keys.Enter Then
        ……………………
    End If
End Sub

Format$ (pour les chaînes de caractères)

VB6

    MonTexte=format$(MonNombre, »000″)

VB.net

    MonTexte=MonNombre.ToString(« 000 »)

Format (pour les dates & heures)

VB6

    MonTexte=format(Now, »yyyy-mm-dd hh:nn:ss »)

VB.net

    MonTexte=DateTime.Now.ToString(« yyyy-MM-dd HH:mm:ss »)
Nota pour VB.net:
    Pour les mois, il faut utiliser  MM (majuscules)
    Pour les minutes, il faut utiliser  mm (minuscules).
    Pour le mode « 24h », il faut utiliser HH (majuscules).
    Pour le mode « 12h », il faut utiliser hh (minuscules), et à la fin , tt. Ex: « yyyy-MM-dd hh:mm:ss tt »

Clipboard

VB6

    Clipboard.Clear
    Clipboard.SetText « MonTexte »

VB.net

    My.Computer.Clipboard.Clear()
    My.Computer.Clipboard.SetText(« MonTexte »)