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

VS 2010 Hmph, I'm stuck yet again.

$
0
0
I have been using some code I got in a previous thread. But I have another question, as you can see here I am trying to make it so that IF TextBox2.Text is between 1-99 ANDALSO there is more than 1 item in listbox1 THEN it will start Timer1. However, I want it so that IF TextBox2.Text is between 1-99 BUT there is less than 1 item in listbox1 then it will tell me that I need to add an item. I also want to add a messagebox for if they type 0 instead of a number between 1-99.

I am confused why this code isn't working... Maybe it's because it's really late.

Code:

        Dim value As Integer
        Integer.TryParse(TextBox2.Text, value)
        If (value > 0 And value < 100) AndAlso ListBox1.Items.Count > 0 Then
            Timer1.Start()
        ElseIf TextBox2.Text = "0" Then
            MessageBox.Show("Type a number between 1-99")
        ElseIf ListBox1.Items.Count < 0 Then
            MessageBox.Show("There are no items in the listbox!")
        Else
            MessageBox.Show("Invalid Number.")
        End If

I want it so that if there is a number between 1-99 and there are more than 0 items in listbox1 then a timer will start.
I also want it so that if the number is 0 then it will tell you to pick a number between 1-99.
I also want it so that if the number isn't a number at all like "ubgadg" or just nothing at all then it will say "Invalid Number"
I also want it so that if there IS a number between 1-99 but no items then it tells you to "ADD ITEMS!"

Sorry if I don't explain it well enough, im freaking tired.

Viewing all articles
Browse latest Browse all 27343

Trending Articles



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