add data to datagrid in a new row (1 Viewer)

zambam

Registered User.
Local time
Today, 11:59
Joined
Mar 19, 2006
Messages
39
i have written code so that certain data is input into the datagrid 'field1' once a cmdbutton is clicked.

but each time that code inputs the data, it overwrites the previous data, and doesnt put the data in a new row underneath. what can i do so the data gets inputted onto a new row each time?

pls help

thanks
 

DrSnuggles

Well the hell is Hudson??
Local time
Today, 19:59
Joined
Sep 14, 2004
Messages
117
Does this not work?:

DataGridName.AddItem data1 & vbTab & data2 & vbTab & data3 . . .

the vbTab will add the data to the next column without having to name the columns directly.

To setup the grid, here's some nifty code:

'Add columns
With DataGridName

.FixedCols = 0
.Cols = 6
.Row = 0
.RowHeight(.Row) = 500

.Col = 0
.Text = "Column Heading 1"
.ColWidth(.Col) = 1000 * sngScale
.ColAlignment(.Col) = 1

.Col = 1
.Text = "Column Heading 1"
.ColWidth(.Col) = 0 'Hidden Column
.ColAlignment(.Col) = 1

.Col = 2
.Text = "Column Heading 3"
.ColWidth(.Col) = 5000 * sngScale
.ColAlignment(.Col) = 1

.Col = 3
.Text = "Column Heading 3"
.ColWidth(.Col) = 1000 * sngScale
.ColAlignment(.Col) = 1

.Col = 4
.Text = "Column Heading 5"
.ColWidth(.Col) = 1350 * sngScale
.ColAlignment(.Col) = 1

.Col = 5
.Text = "Column Heading 6
.ColWidth(.Col) = 1250 * sngScale
.ColAlignment(.Col) = 1

'Etc etc

.FixedRows = 1 ' To prevent the your column headins from scrolling


End With
 

Users who are viewing this thread

Top Bottom