从字符串“”转换长时间无效 [英] Conversion from string "" to long is not valid
问题描述
即使经过大约一个小时的研究,我仍然遇到了无法解决的错误。
I'm getting an error which i can't solve, even after about an hour of research.
从字符串 Waseem-PC\Waseem到long的转换无效
Conversion from String "Waseem-PC\Waseem" to long is not valid
这个错误真的很烦人,我尝试了一切!
非常感谢您的帮助。我想给您的答案一个大拇指,但我必须要有一个更大的代表。
这是我的代码
This error really gets annoying, I tried everything!
I would really appreciate help from you. I would love to give your answers a thumbs up but i have to have a bigger rep.
Here is my code
Private Sub RichTextBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles RichTextBox2.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
RichTextBox1.Text = RichTextBox1.Text And vbNewLine And RichTextBox2.Text
End If
End Sub
推荐答案
您'错误地使用了 然后 关键字,用于(来自MSDN):
You're incorrectly using the And keyword which is used for (from MSDN):
对两个布尔表达式执行逻辑合取,或按位取合
Perform a logical conjunction on two Boolean expressions, or bitwise conjunction on two numeric expressions.
相反,您想使用&
来 连接 字符串...
Instead you want to use &
to concatenate the strings...
这将起作用:
Private Sub RichTextBox2_KeyPress(sender As Object, e As KeyPressEventArgs) Handles RichTextBox2.KeyPress
If Asc(e.KeyChar) = Keys.Enter Then
RichTextBox1.Text = RichTextBox1.Text & vbNewLine & RichTextBox2.Text
End If
End Sub
这篇关于从字符串“”转换长时间无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!