Sufyan

Assignment 3 Program 5

Sep 25th, 2012
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 1.82 KB | None | 0 0
  1. Public Class Form1
  2.     Dim n As Integer = 10
  3.     Dim a(50) As Integer
  4.     Private Sub RadioButton3_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton3.CheckedChanged
  5.         Dim b1 As Integer = ComboBox1.SelectedItem()
  6.         Dim b2 As Integer = ComboBox2.SelectedItem()
  7.         ListBox1.Items.Clear()
  8.         For i As Integer = b1 To b2
  9.             If i Mod (2) <> 0 Then
  10.                 ListBox1.Items.Add(i)
  11.             End If
  12.         Next
  13.     End Sub
  14.  
  15.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
  16.         For i As Integer = 0 To n
  17.             ComboBox1.Items.Add(i)
  18.             ComboBox2.Items.Add(i)
  19.         Next
  20.     End Sub
  21.  
  22.     Private Sub RadioButton1_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton1.CheckedChanged
  23.         Dim Flag As Boolean
  24.         Dim b1 As Integer = ComboBox1.SelectedItem()
  25.         Dim b2 As Integer = ComboBox2.SelectedItem()
  26.         ListBox1.Items.Clear()
  27.         For i As Integer = b1 To b2
  28.             Flag = True
  29.             For j As Integer = 2 To i / 2
  30.                 If (i Mod j = 0) Then
  31.                     Flag = False
  32.                 End If
  33.             Next
  34.             If Flag = True Then
  35.                 ListBox1.Items.Add(i)
  36.             End If
  37.         Next
  38.     End Sub
  39.  
  40.  
  41.     Private Sub RadioButton2_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton2.CheckedChanged
  42.         Dim b1 As Integer = ComboBox1.SelectedItem()
  43.         Dim b2 As Integer = ComboBox2.SelectedItem()
  44.         ListBox1.Items.Clear()
  45.         For i As Integer = b1 To b2
  46.             If i Mod (2) = 0 Then
  47.                 ListBox1.Items.Add(i)
  48.             End If
  49.         Next
  50.     End Sub
  51. End Class
Advertisement
Add Comment
Please, Sign In to add comment