vb点虐 字符串补位 vb 字符串
vb点虐 字符串操作
a="@1991@1205@844@3276@1104@747@1069@0.9@4@3@104810571073
我们提供的服务有:网站建设、做网站、微信公众号开发、网站优化、网站认证、衡山ssl等。为千余家企事业单位解决了网站和推广的问题。提供周到的售前咨询和贴心的售后服务,是有科学管理、有技术的衡山网站制作公司
"
a=Replace(a,"@",",")
a=Replace(a,"",",")
dim b()
b=split(a,",")
vb点虐 实现ComboBox输入字符自动补充字符
Public Sub AutoComplete(ByVal cmb As ComboBox, ByVal e As System.Windows.Forms.KeyPressEventArgs)
If cmb.DataSource Is Nothing Then
Return
End If
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Enter) Then
Return
End If
Dim strFindStr As String = ""
If e.KeyChar = Microsoft.VisualBasic.ChrW(Keys.Back) Then
If (cmb.SelectionStart = cmb.Text.Length) Then
If cmb.Text.Length 0 Then
strFindStr = cmb.Text.Substring(0, cmb.Text.Length - 1)
End If
Else
If cmb.SelectionStart 0 Then
strFindStr = cmb.Text.Substring(0, cmb.SelectionStart - 1)
End If
End If
e.Handled = False
Else
If (cmb.SelectionLength = 0) Then
strFindStr = cmb.Text + e.KeyChar
Else
If (cmb.SelectionStart = cmb.Text.Length) Then
strFindStr = e.KeyChar
Else
If cmb.SelectionStart 0 Then
strFindStr = cmb.Text.Substring(0, cmb.SelectionStart - 1) + e.KeyChar
Else
strFindStr = e.KeyChar
End If
End If
End If
End If
Dim intIdx As Integer = -1
Dim dv As DataView
If TypeOf (cmb.DataSource) Is DataTable Then
dv = CType(cmb.DataSource, DataTable).DefaultView
If strFindStr "" Then
dv.RowFilter = cmb.DisplayMember " Like '%" strFindStr "%'"
Else
dv.RowFilter = ""
End If
cmb.DataSource = dv
cmb.SelectedIndex = -1
cmb.Text = strFindStr
Else
dv = CType(cmb.DataSource, DataView)
If strFindStr "" Then
dv.RowFilter = cmb.DisplayMember " Like '%" strFindStr "%'"
Else
dv.RowFilter = ""
End If
cmb.DataSource = dv
cmb.SelectedIndex = -1
cmb.Text = strFindStr
End If
cmb.SelectionStart = strFindStr.Length
e.Handled = True
End Sub
Private Sub comboBox1_KeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles comboBox1.KeyPress
AutoComplete(sender, e)
End Sub
用VB怎么在字符串左边加指点数目的0
到底是加左边还是加右边啊?
加左边的话可以用Format(number, "000000"),得到的数如果不足6位则自动在左边补0。
加右边的话,可以用
While Len(st)6
st=st+"0"
Wend
得到的st就保证6位
本文名称:vb点虐 字符串补位 vb 字符串
文章出自:http://pwwzsj.com/article/ddjijcp.html