hi guys,
i am making invoice form in vb6, i have to make grid view so that user can add item details in row just by clicking on it and new Grid is open when user want to add new item.
like

productname description qnt rate amount

row1
row2

.....

TOTAL AMOUNT

please help..

Datagridview?
Are you use Vb.Net?
Also what you get so far?
Post your code here. Make some efforts.

i am using vb6 and access.

Dim cn As Connection
Dim rs As Recordset
Dim cm As Command
Private Sub Form_Load()

Set cn = New Connection
Set rs = New Recordset
Set cm = New Command
With cn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Users\Tapati\Desktop\shyamnager\testrun2323.mdb;Persist Security Info=False"
.Open

End With
cm.ActiveConnection = cn
rs.Open "select * from test", cn, adOpenDynamic, adLockOptimistic

now i have datagrid.

grid will look like

productname description qnt rate amount

row1
row2
.....

TOTAL AMOUNT
how can i do this?

Set this :

DataGrid1.AllowAddNew = True ' This line will add new row on datagrid
DataGrid1.AllowUpdate = True ' this line will let you to add data and edit data directly in datagrid

This line will add data directly to database when you write new data on datagrid

Edited 3 Years Ago by Jx_Man

Also dont forget to set recordset as datagrid source. It will link database and datagrid.

Set DataGrid1.DataSource = rs

thank for reply Jx Man.
how can i calculate fields in datagrid colums and get the result in other colums.

Well.. Datagrid is not the control with that purpose.
You can't do many things like write directly to datagrid.
You can use flexgrid instead of datagrid.

This article has been dead for over six months. Start a new discussion instead.