Set ListBox TopIndex : ListBox « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Date Time
8.Development
9.Event
10.File Directory
11.Generics
12.GUI
13.Internationalization I18N
14.Language Basics
15.LINQ
16.Network Remote
17.Reflection
18.Security
19.Thread
20.Windows Presentation Foundation
21.Windows System
22.XML
23.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » ListBoxScreenshots 
Set ListBox TopIndex
Set ListBox TopIndex
 
Imports System
Imports System.Windows.Forms


Public Class MainClass
    
    Shared Sub Main()
        Dim form1 As Form = New Form1

        Application.Run(form1)


    End Sub
End Class

Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is NothingThen
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub
    Friend WithEvents Label1 As System.Windows.Forms.Label
    Friend WithEvents Label2 As System.Windows.Forms.Label
    Friend WithEvents txt As System.Windows.Forms.TextBox
    Friend WithEvents pic As System.Windows.Forms.PictureBox
    Friend WithEvents lstLog As System.Windows.Forms.ListBox
    Friend WithEvents cmd As System.Windows.Forms.Button
    Friend WithEvents Label3 As System.Windows.Forms.Label

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.Container

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
    Friend WithEvents Label4 As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.txt = New System.Windows.Forms.TextBox()
        Me.Label1 = New System.Windows.Forms.Label()
        Me.Label2 = New System.Windows.Forms.Label()
        Me.lstLog = New System.Windows.Forms.ListBox()
        Me.pic = New System.Windows.Forms.PictureBox()
        Me.cmd = New System.Windows.Forms.Button()
        Me.Label3 = New System.Windows.Forms.Label()
        Me.GroupBox1 = New System.Windows.Forms.GroupBox()
        Me.Label4 = New System.Windows.Forms.Label()
        Me.GroupBox1.SuspendLayout()
        Me.SuspendLayout()
        '
        'txt
        '
        Me.txt.Location = New System.Drawing.Point(15620)
        Me.txt.Name = "txt"
        Me.txt.Size = New System.Drawing.Size(19221)
        Me.txt.TabIndex = 1
        Me.txt.Text = ""
        '
        'Label1
        '
        Me.Label1.Location = New System.Drawing.Point(624)
        Me.Label1.Name = "Label1"
        Me.Label1.Size = New System.Drawing.Size(14416)
        Me.Label1.TabIndex = 2
        Me.Label1.Text = "Test keyboard events here:"
        '
        'Label2
        '
        Me.Label2.Location = New System.Drawing.Point(2052)
        Me.Label2.Name = "Label2"
        Me.Label2.Size = New System.Drawing.Size(12816)
        Me.Label2.TabIndex = 2
        Me.Label2.Text = "Test mouse events here:"
        '
        'lstLog
        '
        Me.lstLog.Anchor = (((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom_
                    Or System.Windows.Forms.AnchorStyles.Left_
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.lstLog.IntegralHeight = False
        Me.lstLog.Location = New System.Drawing.Point(8160)
        Me.lstLog.Name = "lstLog"
        Me.lstLog.Size = New System.Drawing.Size(384212)
        Me.lstLog.TabIndex = 0
        '
        'pic
        '
        Me.pic.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D
        Me.pic.Location = New System.Drawing.Point(15648)
        Me.pic.Name = "pic"
        Me.pic.Size = New System.Drawing.Size(19248)
        Me.pic.TabIndex = 3
        Me.pic.TabStop = False
        '
        'cmd
        '
        Me.cmd.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.cmd.Location = New System.Drawing.Point(156100)
        Me.cmd.Name = "cmd"
        Me.cmd.Size = New System.Drawing.Size(8828)
        Me.cmd.TabIndex = 4
        Me.cmd.Text = "Button1"
        '
        'Label3
        '
        Me.Label3.Location = New System.Drawing.Point(24104)
        Me.Label3.Name = "Label3"
        Me.Label3.Size = New System.Drawing.Size(6424)
        Me.Label3.TabIndex = 5
        Me.Label3.Text = "Label3"
        '
        'GroupBox1
        '
        Me.GroupBox1.Anchor = ((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Left_
                    Or System.Windows.Forms.AnchorStyles.Right)
        Me.GroupBox1.Controls.AddRange(New System.Windows.Forms.Control() {Me.Label4, Me.Label1, Me.pic, Me.txt, Me.cmd, Me.Label2})
        Me.GroupBox1.FlatStyle = System.Windows.Forms.FlatStyle.System
        Me.GroupBox1.Location = New System.Drawing.Point(84)
        Me.GroupBox1.Name = "GroupBox1"
        Me.GroupBox1.Size = New System.Drawing.Size(384148)
        Me.GroupBox1.TabIndex = 6
        Me.GroupBox1.TabStop = False
        '
        'Label4
        '
        Me.Label4.Location = New System.Drawing.Point(92108)
        Me.Label4.Name = "Label4"
        Me.Label4.Size = New System.Drawing.Size(5616)
        Me.Label4.TabIndex = 5
        Me.Label4.Text = "And here:"
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(514)
        Me.ClientSize = New System.Drawing.Size(400378)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.GroupBox1, Me.Label3, Me.lstLog})
        Me.Font = New System.Drawing.Font("Tahoma"8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Name = "Form1"
        Me.Text = "Event Tracker"
        Me.GroupBox1.ResumeLayout(False)
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Sub pic_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgsHandles pic.MouseEnter, cmd.MouseEnter
        Log("Mouse Enter")
    End Sub

    Private Sub pic_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgsHandles pic.MouseMove
        log("Mouse Move: " )
    End Sub

    Private Sub Log(ByVal data As String)
        lstLog.Items.Add(data)
        Dim ItemsPerPage As Integer = lstLog.Height \ lstLog.ItemHeight
        lstLog.TopIndex = lstLog.Items.Count - ItemsPerPage
    End Sub
End Class

           
         
  
Related examples in the same category
1.Toggling list box Selection Mode: select one or select more than oneToggling list box Selection Mode: select one or select more than one
2.Draw selected Item in ListBoxDraw selected Item in ListBox
3.Owner Draw ListBoxOwner Draw ListBox
4.Add Item to ListBoxAdd Item to ListBox
5.Add Item to a List Box by clicking a ButtonAdd Item to a List Box by clicking a Button
6.Get Selected Item from ListBoxGet Selected Item from ListBox
7.Add, remove and clear list box itemsAdd, remove and clear list box items
8.List Box and Spinner DemoList Box and Spinner Demo
9.Customize ListBox Font and Item HeightCustomize ListBox Font and Item Height
10.Drag and drop between two ListBoxDrag and drop between two ListBox
11.Enum Binding
w___w___w___.__j_av___a___2s__.c___o___m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.