5.20.2013

VB.NET COMMONLY USED CODE

Display VB.Net Form in the lower right hand corner of the scren
  Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Position the Form in the Lower Right-Hand corner of the screen
        Dim working_area As Rectangle = SystemInformation.WorkingArea
        Dim x As Integer = working_area.Left + working_area.Width - Me.Width
        Dim y As Integer = working_area.Top + working_area.Height - Me.Height
        Me.Location = New Point(x, y)
  End Sub
How to make a textbox respond to the enter key
Public Class Form1
   Declare Function GetAsyncKeyState Lib "user32.dll" (ByVal vKey As Int32) As UShort
  
   Private Sub ctx_txtbox1_KeyDown(sender As Object, e As KeyEventArgs) Handles ctx_txtbox1.KeyDown
        'If the Enter Key which is number 13 is pressed then execute the code
        If GetAsyncKeyState(13) Then
            'do something
        End If
    End Sub
End Class

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.