十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
Dim str0 As String, idx As Long, str1 As String, str2 As String
专注于为中小企业提供成都网站建设、网站建设服务,电脑端+手机端+微信端的三站合一,更高效的管理,为中小企业嘉禾免费做网站提供优质的服务。我们立足成都,凝聚了一批互联网行业人才,有力地推动了1000+企业的稳健成长,帮助中小企业通过网站建设实现规模扩充和转变。
str0 = "122012312}R4561_456}7894321}1234123123}"
idx = str0.IndexOf("}")
Do While idx = 0
str1 = str0.Substring(0, idx)
str2 = str0.Substring(idx + 1)
'在文本框中添加显示str1、str2,代码略
str0 = str2
idx = str0.IndexOf("}")
Loop
给你一个VB2010读写文件的例子吧
Dim name As String = ""
Dim age As Integer
name = InputBox("请输入姓名")
age = InputBox("请输入年龄")
FileOpen(1, "d:\信息.txt", OpenMode.Append)
WriteLine(1, name, age)
FileClose(1)
FileOpen(1, "d:\信息.txt", OpenMode.Input)
Dim h As String
Dim j As String
Dim f As String
f = ""
h = ""
j = ""
While EOF(1) = False
f = LineInput(1) vbCrLf f
End While
FileClose(1)
MsgBox("姓名" " " "年龄" vbCrLf f)
在VB中是这样的,没学过VB.net,你变换一下就可以了
按你说的,用用Left,Right和Mid
Option Explicit
Private Sub Command1_Click()
Dim Num(2)
Num(0) = Val(Left(Label1.Caption, 2))
Num(1) = Val(Mid(Label1.Caption, 3, 1))
Num(2) = Val(Right(Label1.Caption, 2))
MsgBox "Num(0)=" Num(0) vbCrLf "Num(1)=" Num(1) vbCrLf "Num(2)=" Num(2)
'如果想测试是不是可以计算,可以用这一句
'MsgBox "Num(0)+1=" Num(0) + 1 vbCrLf "Num(1)+1=" Num(1) + 1 vbCrLf "Num(2)+1=" Num(2) + 1
End Sub
Private Sub Form_Load()
Label1.Caption = "12345"
End Sub
有问题请追问,满意请采纳!
在VB中是这样的,没学过VB.net,你变换一下就可以了
Option
Explicit
Private
Sub
Command1_Click()
Dim
Num(2)
Num(0)
=
Val(Left(Label1.Caption,
2))
Num(1)
=
Val(Mid(Label1.Caption,
3,
1))
Num(2)
=
Val(Right(Label1.Caption,
2))
MsgBox
"Num(0)="
Num(0)
vbCrLf
"Num(1)="
Num(1)
vbCrLf
"Num(2)="
Num(2)
'如果想测试是不是可以计算,可以用这一句
'MsgBox
"Num(0)+1="
Num(0)
+
1
vbCrLf
"Num(1)+1="
Num(1)
+
1
vbCrLf
"Num(2)+1="
Num(2)
+
1
End
Sub
Private
Sub
Form_Load()
Label1.Caption
=
"12345"
End
Sub
{“Xm”:“李明”,“Dh”:“123456”,“Nl”:“30”}这是个JSON串,在序列化后,可以得到值。你可以使用System.Web.Script.Serialization.JavaScriptSerializer类来完成任务。也可以利用第三方工具比如:Newtonsoft.Json.dll等,来完成任务。
如何使用System.Web.Script.Serialization.JavaScriptSerializer类或第三方工具,网上有大量代码,或参阅微软在线帮助。这里就不贴了。