Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27189

Is there any way to make this smaller or simpler?

$
0
0
Code:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If RadioButton1.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add(TextBox1.Text)
        ElseIf RadioButton2.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("cyan:" & TextBox1.Text)
        ElseIf RadioButton3.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("green:" & TextBox1.Text)
        ElseIf RadioButton4.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("purple:" & TextBox1.Text)
        ElseIf RadioButton5.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("red:" & TextBox1.Text)
        ElseIf RadioButton6.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("white:" & TextBox1.Text)
        ElseIf RadioButton7.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash1:" & TextBox1.Text)
        ElseIf RadioButton8.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash2:" & TextBox1.Text)
        ElseIf RadioButton9.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash3:" & TextBox1.Text)
        ElseIf RadioButton10.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow1:" & TextBox1.Text)
        ElseIf RadioButton11.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow2:" & TextBox1.Text)
        ElseIf RadioButton12.Checked AndAlso RadioButton13.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow3:" & TextBox1.Text)
        ElseIf RadioButton1.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("scroll:" & TextBox1.Text)
        ElseIf RadioButton1.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("shake:" & TextBox1.Text)
        ElseIf RadioButton1.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("slide:" & TextBox1.Text)
        ElseIf RadioButton1.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("wave:" & TextBox1.Text)
        ElseIf RadioButton1.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("wave2:" & TextBox1.Text)
        ElseIf RadioButton2.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("cyan:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton2.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("cyan:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton2.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("cyan:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton2.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("cyan:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton2.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("cyan:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton3.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("green:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton3.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("green:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton3.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("green:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton3.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("green:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton3.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("green:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton4.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("purple:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton4.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("purple:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton4.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("purple:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton4.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("purple:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton4.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("purple:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton5.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("red:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton5.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("red:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton5.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("red:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton5.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("red:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton5.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("red:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton6.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("white:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton6.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("white:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton6.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("white:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton6.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("white:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton6.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("white:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton7.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash1:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton7.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash1:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton7.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash1:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton7.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash1:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton7.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash1:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton8.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash2:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton8.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash2:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton8.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash2:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton8.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash2:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton8.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash2:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton9.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash3:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton9.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash3:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton9.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash3:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton9.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash3:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton9.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("flash3:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton10.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow1:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton10.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow1:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton10.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow1:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton10.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow1:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton10.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow1:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton11.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow2:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton11.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow2:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton11.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow2:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton11.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow2:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton11.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow2:" & "wave2:" & TextBox1.Text)
        ElseIf RadioButton12.Checked AndAlso RadioButton14.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow3:" & "scroll:" & TextBox1.Text)
        ElseIf RadioButton12.Checked AndAlso RadioButton15.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow3:" & "shake:" & TextBox1.Text)
        ElseIf RadioButton12.Checked AndAlso RadioButton16.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow3:" & "slide:" & TextBox1.Text)
        ElseIf RadioButton12.Checked AndAlso RadioButton17.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow3:" & "wave:" & TextBox1.Text)
        ElseIf RadioButton12.Checked AndAlso RadioButton18.Checked AndAlso TextBox1.Text <> Nothing Then
            ListBox1.Items.Add("glow3:" & "wave2:" & TextBox1.Text)
        End If

        If TextBox1.Text <> Nothing Then
            RadioButton1.Checked = True
            RadioButton13.Checked = True
            TextBox1.Text = ""
            TextBox1.Select()
        Else
            MessageBox.Show("Box contains no characters.")
        End If


Viewing all articles
Browse latest Browse all 27189

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>