文件打开的源代码是正确的吗?请指出:
Open d:\单词 For Input As #1
do while not eof(1)
line input #1,x$
a$=a$+x+vbCrlf'或a$=a$+x+Chr(10)+Chr(13)
loop
close #1
text1.text=a$
2 个解决方案
#1
我的一段:
s = String(FileLen(in_path + "\" + one_file + ""), " ") '取文本以内存字符串形式
Open in_path + "\" + one_file + "" For Binary As 1
Get #1, , s
Close 1
v = Split(s, vbCrLf) '给数组v(变体)
main.ProgressBar1.Max = UBound(v)
table_name = CStr(GetIniTF("table_name", "table_name")) '从ini中取表名
For k = 0 To UBound(v) - 1 '遍历数组分别取值插入表
n = Split(v(k), ",")
usermobileno = TrimNull(n(0))
areacode = TrimNull(n(1))
viptype = TrimNull(n(2))
agentname = TrimNull(n(3))
agentmobileno = TrimNull(n(4))
agentmobileno = chang_number(agentmobileno, citycode)
citycode = citycode
groupid = TrimNull(n(5))
str = "insert into " + table_name + " (usermobileno,areacode,viptype,agentname,agentmobileno,citycode,groupid) values ('" + Trim(usermobileno) + "','" + Trim(areacode) + "','" + Trim(viptype) + "','" + Trim(agentname) + "','" + Trim(agentmobileno) + "','" + Trim(citycode) + "','" + Trim(groupid) + "')"
cmd.CommandText = str
cmd.Execute
DoEvents
main.Label7.Caption = Format(main.ProgressBar1.Value * 100 / main.ProgressBar1.Max, "##") & "%"
i = i + 1
main.ProgressBar1.Value = i
Next
s = String(FileLen(in_path + "\" + one_file + ""), " ") '取文本以内存字符串形式
Open in_path + "\" + one_file + "" For Binary As 1
Get #1, , s
Close 1
v = Split(s, vbCrLf) '给数组v(变体)
main.ProgressBar1.Max = UBound(v)
table_name = CStr(GetIniTF("table_name", "table_name")) '从ini中取表名
For k = 0 To UBound(v) - 1 '遍历数组分别取值插入表
n = Split(v(k), ",")
usermobileno = TrimNull(n(0))
areacode = TrimNull(n(1))
viptype = TrimNull(n(2))
agentname = TrimNull(n(3))
agentmobileno = TrimNull(n(4))
agentmobileno = chang_number(agentmobileno, citycode)
citycode = citycode
groupid = TrimNull(n(5))
str = "insert into " + table_name + " (usermobileno,areacode,viptype,agentname,agentmobileno,citycode,groupid) values ('" + Trim(usermobileno) + "','" + Trim(areacode) + "','" + Trim(viptype) + "','" + Trim(agentname) + "','" + Trim(agentmobileno) + "','" + Trim(citycode) + "','" + Trim(groupid) + "')"
cmd.CommandText = str
cmd.Execute
DoEvents
main.Label7.Caption = Format(main.ProgressBar1.Value * 100 / main.ProgressBar1.Max, "##") & "%"
i = i + 1
main.ProgressBar1.Value = i
Next
#2
各位高手们.有一事相求啊.请问有哪位知道用VB.NTE制做通讯录,如何做啊.特别是代码是非常令本人恐惧啊.请各位帮帮忙啊.在下先谢谢各位了!
#1
我的一段:
s = String(FileLen(in_path + "\" + one_file + ""), " ") '取文本以内存字符串形式
Open in_path + "\" + one_file + "" For Binary As 1
Get #1, , s
Close 1
v = Split(s, vbCrLf) '给数组v(变体)
main.ProgressBar1.Max = UBound(v)
table_name = CStr(GetIniTF("table_name", "table_name")) '从ini中取表名
For k = 0 To UBound(v) - 1 '遍历数组分别取值插入表
n = Split(v(k), ",")
usermobileno = TrimNull(n(0))
areacode = TrimNull(n(1))
viptype = TrimNull(n(2))
agentname = TrimNull(n(3))
agentmobileno = TrimNull(n(4))
agentmobileno = chang_number(agentmobileno, citycode)
citycode = citycode
groupid = TrimNull(n(5))
str = "insert into " + table_name + " (usermobileno,areacode,viptype,agentname,agentmobileno,citycode,groupid) values ('" + Trim(usermobileno) + "','" + Trim(areacode) + "','" + Trim(viptype) + "','" + Trim(agentname) + "','" + Trim(agentmobileno) + "','" + Trim(citycode) + "','" + Trim(groupid) + "')"
cmd.CommandText = str
cmd.Execute
DoEvents
main.Label7.Caption = Format(main.ProgressBar1.Value * 100 / main.ProgressBar1.Max, "##") & "%"
i = i + 1
main.ProgressBar1.Value = i
Next
s = String(FileLen(in_path + "\" + one_file + ""), " ") '取文本以内存字符串形式
Open in_path + "\" + one_file + "" For Binary As 1
Get #1, , s
Close 1
v = Split(s, vbCrLf) '给数组v(变体)
main.ProgressBar1.Max = UBound(v)
table_name = CStr(GetIniTF("table_name", "table_name")) '从ini中取表名
For k = 0 To UBound(v) - 1 '遍历数组分别取值插入表
n = Split(v(k), ",")
usermobileno = TrimNull(n(0))
areacode = TrimNull(n(1))
viptype = TrimNull(n(2))
agentname = TrimNull(n(3))
agentmobileno = TrimNull(n(4))
agentmobileno = chang_number(agentmobileno, citycode)
citycode = citycode
groupid = TrimNull(n(5))
str = "insert into " + table_name + " (usermobileno,areacode,viptype,agentname,agentmobileno,citycode,groupid) values ('" + Trim(usermobileno) + "','" + Trim(areacode) + "','" + Trim(viptype) + "','" + Trim(agentname) + "','" + Trim(agentmobileno) + "','" + Trim(citycode) + "','" + Trim(groupid) + "')"
cmd.CommandText = str
cmd.Execute
DoEvents
main.Label7.Caption = Format(main.ProgressBar1.Value * 100 / main.ProgressBar1.Max, "##") & "%"
i = i + 1
main.ProgressBar1.Value = i
Next
#2
各位高手们.有一事相求啊.请问有哪位知道用VB.NTE制做通讯录,如何做啊.特别是代码是非常令本人恐惧啊.请各位帮帮忙啊.在下先谢谢各位了!