我需要一些帮助来显示/允许键盘显示和输入.
我的基本应用程序有一个带按钮的主屏幕,按钮点击它打开一个webview,我的一个按钮打开一个带有输入表单的HTML页面的webview.当您单击输入字段时,键盘不显示,当您在模拟器上使用硬件键盘时,它只会显示中文建议而不输入任何文本.
我已经找到了一些这方面的教程,但它们并不是我正在寻找的,我可以使用以下用于用户名字段和密码字段
Private Sub UsernameTextBox_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles UsernameTextBox.KeyPress
If Char.IsDigit(e.KeyChar) OrElse Char.IsControl(e.KeyChar) OrElse Char.IsLetter(e.KeyChar) Then
e.Handled = False
Else
e.Handled = True
End If
End Sub
Run Code Online (Sandbox Code Playgroud)
但是对于电子邮件字段,我如何防止针对该文本框的SQL注入,因为某些电子邮件帐户中有句号或破折号?
更新: 下面是我使用的插入语句的示例.
Dim con As SqlConnection
con = New SqlConnection()
Dim cmd As New SqlCommand
Try
con.ConnectionString = "Data Source=" & Server & ";Initial Catalog=" & Database & ";User ID=" & User & ";Password=" & Password & ";"
con.Open()
cmd.Connection = con
cmd.CommandText = "INSERT INTO TB_User(STRUserID, password, …Run Code Online (Sandbox Code Playgroud) 我正在尝试将逗号分隔的值添加到组合框。问题是我不知道这是否是将值拆分到组合框的最佳方法。有没有更清洁/更有效的方法来做到这一点?:
Dim toread As String
toread = ini.ReadValue("Schools", "Schools")
Dim textdelimiter As String
textdelimiter = ","
Dim splitout = Split(toread, textdelimiter)
Dim i As Integer
For i = 0 To UBound(splitout)
ComboBox1.Items.Add(splitout(i))
Next
Run Code Online (Sandbox Code Playgroud) 从MSDN文章我读到我应该使用StringBuilder而不是连接普通字符串.但是我不知道为什么我会得到以下错误:"在赋值之前使用变量'ShowString'.在运行时可能会产生空引用异常."
以下代码:
Dim ShowString As StringBuilder
Dim ShowSort As StringBuilder
'ShowString.
ShowString.Append("POS,tdate,Product")
'========Show Options==================
If CheckBox1.Checked = True Then
ShowString.Append(",tkey")
End If
If CheckBox2.Checked = True Then
ShowString.Append(",Price")
End If
If CheckBox3.Checked = True Then
ShowString.Append(",FID")
End If
'==========End Show Options============
'=========Sort Options================
If RadioButton1.Checked = True Then
ShowSort.Append("tdate")
If RadioButton8.Checked Then
ShowSort.Append(" desc")
End If
End If
If RadioButton2.Checked = True Then
ShowSort.Append("tkey")
If RadioButton8.Checked Then
ShowSort.Append(" desc")
End If
End If
'=======End Sort Options=============
Dim sort As String …Run Code Online (Sandbox Code Playgroud)