copyright 1999 - 2014 by heinz prelle - hannover  - lenbachstraße 42 - www.visual-basic5.de | impressum
Beispiel: VB .Net - ComboBox - Zahleneingabe erzwingen
'
Option Explicit On
Option Strict On

Public Class Form1

    Private Sub ComboBox1_Validating(ByVal sender As Object, _
            ByVal e As System.ComponentModel.CancelEventArgs) Handles ComboBox1.Validating
        Dim Result As Integer
        If Not Integer.TryParse(ComboBox1.Text, Result) Then
            MessageBox.Show("Geben Sie eine Zahl in die ComboBox ein!", "Info")
            e.Cancel = True
        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) _
            Handles MyBase.Load
        Me.CenterToScreen()
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _
            Handles Button1.Click
        Me.Close()
    End Sub

End Class
Sourcecode Visual Basic