VB中如何按行读取txt文档中的数据,文档中的一行数据即为一条记录。
文档中的记录格式如下所示(文档中有大量这种记录):
"26",11/16/2010 18:06:34,+08:00,54,,0.0,0,,,,,,,,,777039.6,,,,,,,,
“25",11/16/2010 18:06:37,+08:00,54,,0.0,0,,,,,,,,,779500.3,,,,,,,,
"22",11/16/2010 18:06:44,+08:00,54,,0.0,0,,,,,,,,,778766.0,,,,,,,,
"21",11/16/2010 18:06:46,+08:00,54,,0.0,0,,,,,,,,,778339.0,,,,,,,,
"20",11/16/2010 18:06:49,+08:00,54,,0.0,0,,,,,,,,,780369.1,,,,,,,,
"19",11/16/2010 18:06:51,+08:00,54,,0.0,0,,,,,,,,,780296.9,,,,,,,,
"18",11/16/2010 18:06:53,+08:00,54,,0.0,0,,,,,,,,,777865.7,,,,,,,,
"17",11/16/2010 18:06:56,+08:00,54,,0.0,0,,,,,,,,,776014.5,,,,,,,,
"16",11/16/2010 18:06:58,+08:00,54,,0.0,0,,,,,,,,,778694.1,,,,,,,,
"15",11/16/2010 18:07:00,+08:00,54,,0.0,0,,,,,,,,,780314.6,,,,,,,,
"42",11/16/2010 18:07:03,+08:00,54,,0.0,0,,,,,,,,,929839.8,,,,,,,,
如何把符合特定条件(如第一个字段值为"25"且第二个字段的值为”11/16/2010 8:06:37“)的那一行记录读取出来。
同时,请问能否将帅选出来的多个记录的特定字段(有些字段不需要显示出来的)在DataGrid(数据网格控件)中显示出来。
[解决办法]
Line Input # 语句
从已打开的顺序文件中读出一行并将它分配给 String变量。
语法
Line Input #filenumber, varname
Line Input # 语句的语法具有以下几个部分:
部分 描述
filenumber 必要。任何有效的文件号。
varname 必要。有效的 Variant 或 String 变量名。
[解决办法]
看msdn中关于 line input的帮助就行....
[解决办法]