永发信息网

vb中修改文本的指定行

答案:2  悬赏:10  手机版
解决时间 2021-01-25 02:32
  • 提问者网友:骨子里的高雅
  • 2021-01-24 21:29
500T冷端中控室: d:\a.txt中有以下字符:
AA
AB
AC
AD
AE
AF
等等,有几千项

Open "D:\a.txt" For Input As #1
Do Until EOF(1)
Line Input #1, a
Ds1 = Ds1 & a & vbCrLf
Loop
Close
ds2 = Split(Ds1, vbCrLf)

怎样直接修改ds2数组里的指定项.
如直接把AE改成AD.不要全部重新写入.
最佳答案
  • 五星知识达人网友:荒野風
  • 2021-01-24 23:05
加个计数的,读到某行后,改了在转存到另一个文本内。
全部回答
  • 1楼网友:蕴藏春秋
  • 2021-01-25 00:12
vb.net中删除指定文本文档中的指定行内容代码: yval hwnd as intptr, _ byval wmsg as int32, _ byval wparam as int32, _ byval lparam as string _ ) as int32 private overloads declare auto function sendmessage lib "user32" ( _ byval hwnd as intptr, _ byval wmsg as int32, _ byval wparam as int32, _ byval lparam as int32 _ ) as int32 private const em_getline as int32 = &hc4 private const em_getlinecount as int32 = &hba private const max_char_per_line as int32 = &h100 private const em_linelength as int32 = &hc1 private const em_lineindex as int32 = &hbb private function getline(byval text as textboxbase, byval line as integer) as string dim dwlinestart as int32 = sendmessage(text.handle, em_lineindex, line, 0) dim dwlinelen as integer = sendmessage(text.handle, em_linelength, dwlinestart, 0) dim buff as string = chr(dwlinelen and &hff) & chr(dwlinelen / &h100) & space(dwlinelen) dim dwlen as int32 = sendmessage(text.handle, em_getline, line, buff) getline = strings.left(buff, dwlen) end function private sub button3_click_1(byval sender as system.object, byval e as system.eventargs) handles button3.click dim g as graphics = textbox1.creategraphics() dim w as integer = ctype(g.measurestring(textbox1.text, textbox1.font).width, integer) dim s as string = getline(textbox1, 0) msgbox(s) end sub
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯