如何在datagrid中添加记录 [英] How to add records in datagrid

查看:77
本文介绍了如何在datagrid中添加记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


i有3个文本框

一个命令按钮

一个数据网格



什么我想点击命令按钮数据来自textboxe添加数据网格



i试过这个但得到运行时错误7005行集不可用

请帮助



Hi i have 3 text boxes
one command button
one datagrid

What i want is click on command button data from textboxe add in datagrid

i tried this but getting run time error 7005 "Rowset not available"
Please help

     With DataGrid1
        .AllowAddNew = False
        .AllowDelete = False
        .AllowUpdate = False

Dim col As Column

Set col = DataGrid1.Columns.Add(0)
    col.Value = Text1(0).Text
    col.Caption = "Article"

End With

推荐答案

看看这里:

Visual Basic 6.0的DataGrid控件用户 [ ^ ]

vbtutor - 第26课:使用Microsoft DataGrid Control 6.0 [ ^ ]
Have a look here:
DataGrid Control for Visual Basic 6.0 Users[^]
vbtutor - Lesson 26: Using Microsoft DataGrid Control 6.0[^]


检查这些这可以帮到你:

VB.NET中的文本框到Datagrid视图 [ ^ ]

从文本框到datagridview [ ^ ]

将数据从文本框传递到datagridview [ ^ ]
Check these which can help you:
Textbox to Datagrid View in VB.NET[^]
From textbox to datagridview [^]
passing data from textbox to datagridview[^]


感谢您帮助我们。

根据ridoy建议我得到了这个解决方案,但是MSHFlexGrid不是数据网格,而且工作正常。





Thanks for helping me guys.
according to ridoy suggestion i got this solution, but with MSHFlexGrid not datagrid and its working fine.


<pre lang="vb">

Dim intRow As Integer

MSHFlexGrid1.Rows = MSHFlexGrid1.Rows + 1 ' If you need to increase the number of rows

With MSHFlexGrid1

    .TextMatrix(intRow + 1, 1) = Text1.Text
    .TextMatrix(intRow + 1, 2) = Text2.Text
    .TextMatrix(intRow + 1, 3) = Text3.Text
end with
     intRow = intRow + 1

</pre>


这篇关于如何在datagrid中添加记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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