VB 2008-文本框:在空数组上退格 [英] VB 2008 - Textbox : Backspace on an empty array
问题描述
我想添加一个实例,如果数组为空,则不能在其中退格,如A(3)所示.因为现在如果在空数组上退格,则只需回到A(2).
I wanna add an instance in which you can't backspace if the array is empty, as in A(3). Because right now if you backspace on an empty array it just go back up to A(2).
示例:
A(1)*不要空*
A(1) *NOT EMPTY*
A(2)*不要空*
A(2) *NOT EMPTY*
A(3)*空*
当前代码使用:
If i = Keys.Back Then
add coding here
Else
TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Count - 1)
End If
推荐答案
我想添加一个实例,如果数组为空,则不能在其中退格,如A(3).
I wanna add an instance in which you can't backspace if the array is empty, as in A(3).
如果不是A(3),那么TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Count-1)
If Not A(3) Is Nothing then TextBox1.Text = TextBox1.Text.Remove(TextBox1.Text.Count - 1)
但是您怎么知道它是需要测试的A(3),而不是A(2)或A(4)?您说如果在空数组上退格,则只需回到A(2)"即可.但是无论A(2)是否为空,您都没有任何代码来调整数组索引.
But how do you know it is A(3) you need to test, and not A(2) or A(4)? You say that "if you backspace on an empty array it just go back up to A(2)" but you don't have any code to adjust the array index, whether A(2) is empty or not.
这篇关于VB 2008-文本框:在空数组上退格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!