【发布时间】:2013-09-03 14:28:55
【问题描述】:
这就是我想要实现的想法。
在文本框中,我输入“增加 50%”。我点击了另一个按钮来显示确切的文本。数字、字母和一些符号正确显示。但是,某些符号,例如 % ^ ( 和 ) 不会显示。我发现我必须使用 SendKeys.Send("{%}") 函数来发送该特定键和其他一些键。好吧,没什么大不了的。但是我想要完成的是,当我使用 SendKeys.Send("{%}") 函数时,它会在 OUTPUT 上发送 % EVERYTIME,即使我可能输入了一些不同的东西,但没有包含它.基本上我想要 % WHEN I CALL IT,而不是一直。我希望这有帮助。这也是我的代码。
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) 处理 Timer1.Tick 出错时继续下一步
If CheckBox1.Checked = True Then 'Only Checked Items of the CheckedListbox
If IntCount > CheckedListBox1.CheckedItems.Count - 1 Then 'If the index is higher then the max. index of the checkedlistbox
IntCount = 0 ' The index will reset to 0
End If
SendKeys.SendWait(CheckedListBox1.CheckedItems(IntCount).ToString & "{ENTER}") 'Send keys to the active windows
IntCount += 1 'Goto the next line
Else 'All items
If IntCount > CheckedListBox1.Items.Count - 1 Then 'If the index is higher then the max. index of the checkedlistbox
IntCount = 0 ' The index will reset to 0
End If
SendKeys.SendWait(CheckedListBox1.Items(IntCount).ToString & "{ENTER}") 'Send keys to the active windows
IntCount += 1 'Goto the next line
SendKeys.Send("{%}") 'HERE THE % SYMBOL IS DISPLAYED EVERYTIME. NOT WHAT I WANT! ONLY WHEN I CALL IT IN THE INPUT TEXTBOX!
End If
【问题讨论】:
-
你真的需要改写你的问题,我不知道你到底在问什么
-
尝试实现一个代码,其中“如果我的文本包含 %,请将 % 替换为“{%}”。不确定将其放在哪里..