|
Not sure if that is what you need but sounds like:
for index=1 to datagrid.count-1
datagrid.rows(index).item("Column6")=datagrid.rows(index-1).item("Column6")-datagrid.rows(index).item("Column4")
next index
Briga
|
|
|
|
|
ummm... I dont understand why count is underlined as wrong and datagrid.rows is wrong??
any suggestions?
thanx
|
|
|
|
|
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
|
|
|
|
|
|
How can create Setup File for VB6 Project with "Wise for windows Installer"?
|
|
|
|
|
better off with innosetup or others
|
|
|
|
|
Consult the "Wise For Windows Installer" documentation. You've asked a very vague question, listing no details of what you're having a problem with. On top that, this is the Visual Basic Forum, not a Wise Product Support Forum.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi..
i have make 3 forms
1 mdi parent and 2 mdi child
calling a child to show at parent is easy
but hoow to make a child call another child and show it in the parent?
this is basically how it look like..
form1(parent) call form2(child)....form2 show in form1
form2(child) call form3(child).....form3 show in form1
i try to code the button in form2
like so
Dim frm3 as New Form3
Dim frm1 as New Form1
frm3.mdiparent = frm1
frm3.show
which is not working...am i doing it wrong?
please help me...thank you in adnvace
Gary
|
|
|
|
|
Try this:
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim frm2 As New Form2
frm2.MdiParent = Me
frm2.Show()
End Sub
End Class
Public Class Form2
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm3 As New Form3
frm3.MdiParent = Me.ParentForm
frm3.Show()
End Sub
End Class
|
|
|
|
|
tried....but this error show up
An unhandled exception of type 'System.NullReferenceException' occurred in WindowsApplication7.exe
Additional information: Object reference not set to an instance of an object.
and still unable to show the second child
Gary
|
|
|
|
|
Try Owner instead of ParentForm . ParentForm gets the form on which a control is placed. Owner should get (if I remember right) the owning form of a child form.
|
|
|
|
|
I'm sorry Gary, I tested my previous example on VisualBasic 2005 Beta and it works there. You're right it does produce an error on my VS 2003. I tested this on VS 2003 and it works.
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim frm3 As New Form3
frm3.MdiParent = Me.MdiParent
frm3.Show()
End Sub
|
|
|
|
|
Thanks OIC
is working now
thank for all the help....both of u thank you
Gary
|
|
|
|
|
I am trying to delete any row selected using
<br />
Dim SelectRow() As DataRow = DS.Tables(0).Select()<br />
DS.Tables(0).Rows.Remove(SelectRow(0))<br />
But Since i have the selected row set to row 0 it only deletes row 0.
is there something I could put in the place of 0 to represent any selected row so that it will stop deleting only row 0?
thanks
|
|
|
|
|
hi; try this
DS.Tables(0).Rows(datagrid.SelectedIndex)
when you select any row in DG you can get the selected index and can use it to have the row from DS
thanx
|
|
|
|
|
Im confused because when I entered this the whole thing was underlined.you already know what that means im sure. should I be entering it elsewhere or what.
I greatly appreciate the time you are sparing to help me.
|
|
|
|
|
dear
use it where you need, i gave you the way to get any selected row in grid so use it in any method such as (dag.selectedindexchange) to get the selected row or the id or any thing
thanx
|
|
|
|
|
How can fetch data from .DBF data file(FoxPro)with VB6?
|
|
|
|
|
There is a ODBC driver which works with .dbf files. I think its called something like "Microsoft dBase driver" and can be downloaded somewhere on msdn. With it you can then access those files with the normal ADO mechanisms.
|
|
|
|
|
My Project is "Car Rental".
I hve the following doubts while designing and coding my work. I have one table called "Avaliablity" where i used to record information about the booked cars.
I am doing my project on car hire. Meanwhile i came across your site. Its really great. I have some questions too.
1. Once a customer booked a car am trying to put one entry in to 'Avaliablity Table' . So do i hve to refer this table in future if a second customer comes and demand the same car.
2. Also how can i keep the transaction table. i mean the "Booking Table" . Do i hve to keep the particular record open until the customer clear his amount or payment for the car rental.
3. I hve a GUI screen to add new vehicle to the Car rental agenty. do i hve to hve Edit option in the GUI screen for the "Vehicle Table". If so i should allow them to update the mileage only.
4. Do i hve to add "Payment Options" to my project.
|
|
|
|
|
Hi all,
I would like to insert all records found in my datagrid into my table. The following code works but then there are limitation.
I am using a For next loop to insert the rows from teh grid.
The problem is if there less than 21 records then VB throws this error:
No row at index.
Can some one help mewith this.
Tnx
Here is the code for Button_click
Dim da As New OleDbDataAdapter()
Dim da1 As New OleDbDataAdapter()
da.SelectCommand = New OleDbCommand()
da.SelectCommand.Connection = conn
da1.SelectCommand = New OleDbCommand()
da1.SelectCommand.Connection = conn
If conn.State <> ConnectionState.Open Then conn.Open()
da.SelectCommand.CommandText = "Delete from Test where rectp = 'SH' and pkey = '001'"
da.SelectCommand.CommandType = CommandType.Text
da.SelectCommand.ExecuteNonQuery()
Dim Icount As Integer
For Icount = 0 To 20
If DBgrid2.Item(Icount, 0) <> "null" And DBgrid2.Item(Icount, 1) <> "null" And DBgrid2.Item(Icount, 2) <> "null" And DBgrid2.Item(Icount, 3) <> "null" Then
da1.SelectCommand.CommandText = "insert into Test values('SH','" & Format(vBcust, "0000000") + Format(vSeqno, "000") & "'," & Icount & ",'" & DBgrid2.Item(Icount, 0) & "','" & DBgrid2.Item(Icount, 2) & "','" & DBgrid2.Item(Icount, 3) & "')"
da1.SelectCommand.CommandType = CommandType.Text
da1.SelectCommand.ExecuteNonQuery()
End If
Next
|
|
|
|
|
hi
why don't u bind the table with datagrid like this
datagrid.datasource=DATAADAPTERUSED
datagrid.datamember=TABLENAME
then u will only need this command to update ur table
DATAADAPTERUSED.update(TABLENAME)
|
|
|
|
|
I could not understand the solution.
Can you pls explain in detail.
Tnx
|
|
|
|
|
Hi.
I’ve been trying to create an app witch can stream live from a webcam to a file.
I'm using the avicap32.dll.
But all attempts have failed due to the callback function.
I keep getting errors like:
Object reference not set to an instance of an object
Do any of you know of a working example???
|
|
|
|
|
Never mind. Made it work.
|
|
|
|