如标题,现在我要把DataGrid控件中的一些数据批量输出到TXT文档中。请问该怎么实现? 我是新手哇
解决方案 »
- 为什么在VB中画出的控件(如按钮),比C++(如任务管理器)中的控件难看的多?
- 求助:用mschart绘图 出现从曲线终点到零点(0,0)的一条直线
- VB 打印图片的问题
- vb 调用水晶报表2008
- 将一个连接对象(DBCONN1)通过引用传递给某个函数,为什么在该函数中不能通过获取传引用过来的DBCONN1的ConnectionString,而建立另外一个新
- 请问在VB中如何获得SQL server返回值(Sp_GetAppLock)
- 如何获取dos程序中的变量!
- 求购一ActiveX控件,具体功能QQ里详细说明QQ:312041
- 诚聘高手做软件
- 菜鸟问题,请帮忙,不好意思,分数不多。
- 如何判断INI文件存在,不存在,如何生成这个文件
- 音乐播放
Dim i, j
For j = 0 To Me.Adodc1.Recordset.RecordCount - 1
For i = 0 To Me.Adodc1.Recordset.Fields.Count - 1
Me.DataGrid1.Row = j
Me.DataGrid1.Col = i
Debug.Print Me.DataGrid1.Text; " ";
Next i
Debug.Print
Next j
您好,谢谢您的答复。
Shell "cmd /c echo > c:\试题.txt", 0 通过这条语句我在C盘建立了一个TXT文本。
我希望能够直接写入文本当中。 现在不懂如何写进去我很菜的,现在做一个题库管理系统,在这卡了
varOutput = Adodc1.Recordset.GetString(adClipString)
Open "c:\试题.txt" For Output As #1
Print #1, varOutput
Close #1
Dim i, j
Open "c:\试题.txt" For Output As #1
For j = 0 To Me.Adodc1.Recordset.RecordCount - 1
For i = 0 To Me.Adodc1.Recordset.Fields.Count - 1
Me.DataGrid1.Row = j
Me.DataGrid1.Col = i
Print #1, Me.DataGrid1.Text+ " "
Next i
Print #1,chr(13)
Next j
close #1
你试过了?
GetString 方法缺省提取记录集所有的行,行间用 vbCrLf 分隔,字段用 vbTab 分隔。
因此,不需要循环。
你试过了?
GetString 方法缺省提取记录集所有的行,行间用 vbCrLf 分隔,字段用 vbTab 分隔。
因此,不需要循环。
嗯嗯 试过了啊 只能输出第一行的数据
Dim i, j
Open "c:\试题.txt" For Output As #1
For j = 0 To Me.Adodc1.Recordset.RecordCount - 1
For i = 0 To Me.Adodc1.Recordset.Fields.Count - 1
Me.DataGrid1.Row = j
Me.DataGrid1.Col = 1
Print #1, Me.DataGrid1.Text+ " "
Me.DataGrid1.Row = j
Me.DataGrid1.Col = 4
Print #1, Me.DataGrid1.Text
Next i
Print #1,vbCrLf
Next j
close #1
Dim i, j
Open "c:\试题.txt" For Output As #1
For j = 0 To Me.Adodc1.Recordset.RecordCount - 1
Me.DataGrid1.Row = j
Me.DataGrid1.Col = 1
Print #1, Me.DataGrid1.Text+ " "
Me.DataGrid1.Row = j
Me.DataGrid1.Col = 4
Print #1, Me.DataGrid1.Text
Print #1,vbCrLf
Next j
close #1