Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Label1.Visible = True ' If ListBox1.Items.Count = 0 Then 'MsgBox("Listbox empty") 'Else If ListBox1.Items.Count > 0 Then Dim i As Integer = 0 ProgressBar1.Maximum = 100000 ProgressBar1.Minimum = 0 ProgressBar1.Value = 0 For i = ProgressBar1.Minimum To ProgressBar1.Maximum ProgressBar1.Value = i If ProgressBar1.Value = ProgressBar1.Maximum Then Dim rnd As New Random Dim randomIndex As Integer = rnd.Next(0, ListBox1.Items.Count) MessageBox.Show(ListBox1.Items(randomIndex)) End If Next Else MsgBox("add items") End If End Sub Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub ' Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' Label2.Text = Date.Now() Private Sub ComboBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged ListBox1.Items.Add(ComboBox1.SelectedItem) End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim file_name As String = "z:\dahra\test\test.txt" Dim objReader As New System.IO.StreamReader(file_name) TextBox1.Text = objReader.ReadToEnd 'TextBox1.Text =dim System.IO.StreamReader(file_name).rea objReader.Close() End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged End Sub Private Sub Label2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label2.Click End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick 'Label2.Text = Date.Now Me.Opacity = Me.Opacity - 0.1 'If Me.Opacity <= 0 Then Me.Close() End Sub Private Sub Form1_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed 'MsgBox("Thanks") Timer1.Enabled = True End Sub Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click If TextBox2.Text = "" Then MsgBox("Please enter the Name ") Else ListBox1.Items.Add(TextBox2.Text) TextBox2.Text = "" End If End Sub Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click If ListBox1.SelectedIndex < 0 Then MsgBox("select item to remove") Else ListBox1.Items.RemoveAt(ListBox1.SelectedIndex) End If End Sub Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Me.Visible = False End Sub Private Sub TrackBar1_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TrackBar1.Scroll End Sub Private Sub TextBox3_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox3.KeyPress ' Dim allowedChars As String = "0123456789" 'If allowedChars.IndexOf(e.KeyChar) = -1 Then ' Invalid Character 'e.Handled = True 'End If '..................................................................................................... 'allow only numbers, the Backspace key and the period If (e.KeyChar < "0" OrElse e.KeyChar > "9") _ AndAlso e.KeyChar <> ControlChars.Back Then 'cancel keys e.Handled = True End If End Sub Private Sub TextBox3_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox3.TextChanged End Sub Private Sub ListBox1_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ListBox1.SelectedIndexChanged End Sub End Class
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)