Click here to Skip to main content
15,922,696 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralOpenFileDialog Pin
G-Viking9-Jan-05 9:38
G-Viking9-Jan-05 9:38 
GeneralRe: OpenFileDialog Pin
Robert Rohde9-Jan-05 20:07
Robert Rohde9-Jan-05 20:07 
GeneralRe: OpenFileDialog Pin
G-Viking9-Jan-05 22:19
G-Viking9-Jan-05 22:19 
GeneralCollectionEditor Pin
vocaris9-Jan-05 6:22
vocaris9-Jan-05 6:22 
Generalrow addition Pin
Makniteasy8-Jan-05 21:55
Makniteasy8-Jan-05 21:55 
GeneralRe: row addition Pin
Briga9-Jan-05 21:52
Briga9-Jan-05 21:52 
GeneralRe: row addition Pin
Makniteasy10-Jan-05 20:57
Makniteasy10-Jan-05 20:57 
GeneralRe: row addition Pin
Briga11-Jan-05 23:51
Briga11-Jan-05 23:51 
Well I replied quickly and typed the code just to give you the idea.

The error you get is because the count and rows should refer the realdatabase you have behing the datagrid (dataset or dataview or whatever). Since I don't know the architecure of your application I don't konw how to address it but you can easily transpose the following code:

Let's suppose you have a dataset called d1 with a table t1 with two columns: c1 & c2. Where c2 is the progressive total as you want.

You can create a sub passing the table, the index of the value column and the index of the progressive total column as follows:

private sub RecalcProgressive(dt as datatable,i1 as integer,i2 as integer)
dim index as integer
'
if dt.rows.count=0 then exit sub ' If no records then exit
dt.rows(0).item(i2)=dt.rows(0).item(i1) ' First line only progressive=value
if dt.rows.count=1 then exit sub ' If only one line then it's done
for index=1 to dt.rows.count-1 ' For each line in the DB
dt.rows(index).item(i2)=dt.rows(index).item(i1)+dt.rows(index-1).item(i2) ' Calc
next index
end sub

Then, according to the hypothesis before, you can call it:

public sub Main
<...>
RecalcProgressive(d1.t1,1,2)
<...>
end sub

Bye
Briga
Generaltool tip for list combo box Pin
casino japan8-Jan-05 21:21
casino japan8-Jan-05 21:21 
GeneralWise for windows Installer 2.02 Pin
paykani8-Jan-05 20:15
paykani8-Jan-05 20:15 
GeneralRe: Wise for windows Installer 2.02 Pin
casino japan8-Jan-05 21:19
casino japan8-Jan-05 21:19 
GeneralRe: Wise for windows Installer 2.02 Pin
Dave Kreskowiak10-Jan-05 3:31
mveDave Kreskowiak10-Jan-05 3:31 
Generalmdi child problem Pin
GaryKoh8-Jan-05 18:49
GaryKoh8-Jan-05 18:49 
GeneralRe: mdi child problem Pin
OICU8128-Jan-05 20:25
OICU8128-Jan-05 20:25 
GeneralRe: mdi child problem Pin
GaryKoh9-Jan-05 3:58
GaryKoh9-Jan-05 3:58 
GeneralRe: mdi child problem Pin
Robert Rohde9-Jan-05 4:58
Robert Rohde9-Jan-05 4:58 
GeneralRe: mdi child problem Pin
OICU8129-Jan-05 5:34
OICU8129-Jan-05 5:34 
GeneralRe: mdi child problem Pin
GaryKoh9-Jan-05 11:51
GaryKoh9-Jan-05 11:51 
GeneralDataGrid Rows Pin
8-Jan-05 17:04
suss8-Jan-05 17:04 
GeneralRe: DataGrid Rows Pin
Palestine_Guy8-Jan-05 20:47
Palestine_Guy8-Jan-05 20:47 
GeneralRe: DataGrid Rows Pin
Makniteasy8-Jan-05 21:13
Makniteasy8-Jan-05 21:13 
GeneralRe: DataGrid Rows Pin
Palestine_Guy9-Jan-05 22:19
Palestine_Guy9-Jan-05 22:19 
QuestionFoxpro Data with VB6? Pin
paykani8-Jan-05 16:56
paykani8-Jan-05 16:56 
AnswerRe: Foxpro Data with VB6? Pin
Robert Rohde9-Jan-05 6:17
Robert Rohde9-Jan-05 6:17 
GeneralDatabase question Pin
sangsram8-Jan-05 14:17
sangsram8-Jan-05 14:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.