0

So I'm kind of new to VB.NET on Visual Studio 2010 and I'm trying to do like a simple "cripter" I think. So basically what I'm doing is every time someone puts a letter or number, on the textbox it gives a random string. So the user puts on the textbox the letter A and gives the string 1123k. Is there anyway that I can do so that the after message where shows 1123k only show when button1 is clicked? Because if the user puts abc it will show 3 times the same string. Heres little bit of the code.

If (TextBox1.Text = ("b")) Then
    MessageBox.Show("ak281a")
End If 
Tim
  • 28,212
  • 8
  • 63
  • 76
  • Do not use the TextChanged event then – Steve Jan 23 '16 at 18:44
  • You're writing VB.NET code, not C#. There is a distinct difference. Also, post more of your code - the little snippet you posted does not give nearly enough context. – Tim Jan 23 '16 at 18:50
  • Also: there's no such thing as "virtual basic 2010". It's Visual Basic.Net and Visual Studio 2010. – Joel Coehoorn Jan 23 '16 at 18:51
  • @Isaac 1. Generate random string - http://stackoverflow.com/questions/1122483/random-string-generator-returning-same-string 2. Associate chars with string - http://stackoverflow.com/questions/10250232/what-is-the-easiest-way-to-handle-associative-array-in-c – Eugene Podskal Jan 23 '16 at 18:58

1 Answers1

0

Try to use a switch case for any case you have

string text = TextBox1.ToString();
Switch (text)
      case A:
            break;
        ...
      case Z:
            break;