如何在vb6中显示MSHFlexGrid中的文本文件条目 [英] How to show the text file entries in MSHFlexGrid in vb6

查看:99
本文介绍了如何在vb6中显示MSHFlexGrid中的文本文件条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个文本文件,其条目为



Alan

Priya

Niva

Zia













我想在数据网格中的表单上显示这些.Plz告诉我如何在数据网格的单元格中逐个分配这些值。 div class =h2_lin>解决方案

这样的事情应该有效

  Dim  f  As   Integer  
f = FreeFile
打开 c:\ temp \ myFile.txt 对于输入作为 #f

Dim col As 整数,row 作为 整数
col = 1
row = 1

Dim text_to_enter 作为 字符串
直到EOF(f)
输入#f,text_to_enter
MSFlexGrid1.TextMatrix(row,col)= text_to_enter
row = row + 1
' 或者您要决定将数据输入哪个列/行
循环
关闭#f



警告 - 我不知道有VB6了,所以我无法测试这个



一些可能有用的参考资料:

使用FlexGrid控件 [ ^ ]

阅读简单文本文件 [ ^ ]


Hi, i have a text file whose entries are as

Alan
Priya
Niva
Zia
.
.
.
.


I want to show these on a form in data grid.Plz tell how can i assign these one by one value in the cells of the data grid.

解决方案

Something like this should work

Dim f As Integer
f = FreeFile
Open "c:\temp\myFile.txt" For Input As #f

Dim col As Integer, row As Integer
col = 1
row = 1

Dim text_to_enter As String
Do Until EOF(f)
	Input #f, text_to_enter
	MSFlexGrid1.TextMatrix(row, col) = text_to_enter
	row = row + 1  
        'or however you are deciding which column/row to enter the data into
Loop
Close #f


Warning - I don't have VB6 any more so I haven't been able to test this

Some references that might help:
Using the FlexGrid control[^]
Reading Simple Text Files[^]


这篇关于如何在vb6中显示MSHFlexGrid中的文本文件条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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