# Visual Basic 2008 - InputBox input problem



## KingIsulgard (Oct 13, 2008)

Hi all, 
I got a little problem with an inputBox that doesn't give the input I want.

I narrowed down my code to the following:


```
Dim myValue As String   
        Dim countNames As Integer   
        countNames = 0  
  
        Do   
            myValue = InputBox("Give a word:", "Insert word...", "")   
            If myValue Is Not ""   
                countNames += 1   
            End If   
        Loop Until myValue Is ""
```
The problem is that my loop just keep going, even when I pressed cancel or insert nothing in the inputBox.

Why doesn't he get out of the loop when it sees that there was NO input?

Please help me, I have been trying all kind of things like vbNullString and such.


----------



## jamiemac2005 (Jul 5, 2007)

Hey i see no problem with your code, but to get it to compile on my own pc i had to change the Is operators, i'm using an older version of VB but you could try:

```
If myValue <> ""

and

Loop Until myValue = ""
```
After i made those changes it worked fine on my PC.
Though i don't fully understand why it wouldn't with the "Is" operator.

Give it a try and tell us how you get on.

Cheers,
Jamey


----------



## KingIsulgard (Oct 13, 2008)

Thanks mate,
this solved my problem.

Weird bug anyway


----------



## jamiemac2005 (Jul 5, 2007)

Thats k,
that is a weird one, it took me a while to work it out myself(i had to go as far as compiling on my own pc.)

Cheers,
Jamey


----------

