使用VB 6从文本文件中读取并显示特定数据到列表框中 [英] Read and display specific data from text file into listbox using VB 6

查看:580
本文介绍了使用VB 6从文本文件中读取并显示特定数据到列表框中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在为我的硕士研究建立一个关于水库运行信息系统的程序。现在我有一个文本文件,它是处理软件(Terramodel)的输出文件,列出了列和行中的高程范围和体积。文本文件看起来像这样;


------------------------------- ------------------

-software'的经销商地址 -

-project description-


深度范围体积

(m)(m3)

0.000> 0.001 10.0

0.001> 0.002 12.0

。 。

。 。

。 。


累积量

(m3)

500

------- ------------------------------------------


现在我已经编写了使用AddItem在列表框中显示数据的代码,但整行显示在列表框中的一行中。我想只显示深度范围和体积数据,从''0.000>开始。 0.001’ 。那么,如何跳过阅读文件头(软件的分销商地址和项目描述)和数据栏的标题(深度范围(m)和体积(m3))?

谢谢您的时间。

Hi,

I am building a program on Information System for Reservoir Operation for my Masters research. Now I have a text file which is an output file from a processing software (Terramodel) that lists out Elevation Range and Volume in columns and rows. The text file looks like this;

-------------------------------------------------
-software''s distributor address-
-project description-

Depth range Volume
(m) (m3)
0.000 > 0.001 10.0
0.001 > 0.002 12.0
. .
. .
. .

cummulative volume
(m3)
500
-------------------------------------------------

now i''ve written the code to display the data in listbox using AddItem, but the whole lines are displayed in one single line in the listbox. I want to display only the Depth Range and Volume data, starting from ''0.000 > 0.001''. So, how to skip reading the file header (software''s distributor address & project description) and the data column''s header (Depth range (m) & Volume (m3))?

Thank You for your time.

推荐答案

我希望这会有所帮助。

(另见附件)

I hope this will help.
(see also attachment)

展开 | 选择 | Wrap | 行号


hi ggeu,


tq,效果很好。但仍有一个问题。它只读取深度范围,而不是体积(值10.00,接近0.000> 0.001)。还有一件事,我如何在符号>之前和之后分隔值。在不同的栏目?最终显示应该是3列,1)初始深度,在>之前,2)结束深度,在符号>之后,和3)体积。所有三列都需要在数组中声明为三个变量,因为它将在以后的过程中使用。我该怎么做?


你的帮助非常感谢,TQ。
hi ggeu,

tq, that works nicely. but still, there is a problem in that. it reads only the depth range, not the volume (value 10.00, next to 0.000 > 0.001). 1 more thing, how can i separate the values before and after the symbol ">" in different columns? the final display should be in 3 columns, 1) initial depth, before ">", 2) end depth, after symbol ">", and 3) volume. all three columns need to be declared into three variables perhaps in arrays, because it will be used in later process. how can i do this?

your help is most appreciated, TQ.


我希望这会有所帮助:

如果您想要一个包含列的表,则必须使用网格。 (参见附件)。

您可以使用数组拆分输入文本并使用AddItem将数组中的不同部分放在网格中。





I hope this will help:
If You want a table with Columns, than You have to use a Grid. (see attachment).
You can use a array to split the inputtext and use "AddItem" to place the different parts from the array in the grid.
附加文件
使用VB 6_v2.zip 将文本文件中的特定数据显示到列表框中(2.3) KB,369 views)
Attached Files
Read and display specific data from text file into listbox using VB 6_v2.zip (2.3 KB, 369 views)


这篇关于使用VB 6从文本文件中读取并显示特定数据到列表框中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆