You're implicitly (doing automatically without being specific) casting a String into a Long. That can cause problems as if I typed a letter into the text box the whole thing would crash. Use a NumericUpDown control or do some simple checks to make sure it's valid.
Originally Posted by TheJoker02
Dim my_value As Long
If Long.TryParse(TextBox1.Text, my_value) Then 'This will try to convert the string into a Long
'Worked, now we can use my_value to write into memory
mem.SetMemory(&H123456, my_value, 4)
'Oh no, didn't work