各位大哥,我没分了! 谁帮我!!!~~~~~
怎么把DataGrid1的数据导入记事本当中!! 问题点数:0、回复次数:5Top
1 楼kmzs(.:RNPA:.山水岿濛)回复于 2003-08-01 14:49:05 得分 0
是回答问题还是给你点分?Top
2 楼suntt(两条腿的狗)回复于 2003-08-01 15:02:07 得分 0
怎么个给分法Top
3 楼niqiu(niqiu)回复于 2003-08-01 15:03:00 得分 0
假定你已把DataGrid1通过循环放到一个字符串Str中
则可以:
Shell "notepad.exe", vbNormalFocus
SendKeys str '"Hello World!"
Top
4 楼Cooly(☆不做开发很久了......☆)回复于 2003-08-01 15:06:21 得分 0
DataGrid1的数据从何而来?绑定的ADO数据源?
1.你可以直接将记录写成文本文件
假设rs为结果集(Recordset)
dim i as integer
dim tmp as string
open "c:\data.txt" for output as #1
do until rs.eof
tmp=""
for i=0 to rs.fields.count-1
if tmp="" then
tmp=rs(i).value
else
tmp=tmp & "," & rs(i).value
end if
next
print #1,tmp
rs.movenext
loop
close #1
2.另外可以用DataGrid控件自己的属性
dim i as long,j as long
dim tmp as string
open "c:\data.txt" for output as #1
for i=0 to DataGrid1.ApproxCount-1
tmp=""
for j=0 to DataGrid1.Columns.Count-1
DataGrid1.Row=i
DataGrid1.Col=j
if tmp="" then
tmp=DataGrid1.Text
else
tmp=tmp & "," & DataGrid1.Text
end if
next
print #1,tmp
next
close #1Top
5 楼Cooly(☆不做开发很久了......☆)回复于 2003-08-01 15:09:08 得分 0
数据已经导入到文本文件data.txt中,
然后可以用Shell "notepad c:\data.txt",vbNormalFocus的方式打开.
不知道这些是否你需要.(我没有测试,你要调试一下再用)Top



