By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,219 Members | 2,147 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,219 IT Pros & Developers. It's quick & easy.

ARGH! Still working on Grand Totals...

P: n/a
Hi All :-)

Cor & David, Thank you for your help, sorry I did not reply before now, but
for some reason my Newsgroup Reader (Outlook) does not show your last posts.
The last one I got from Cor was asking me to clarify what I needed. I
checked in the Web Newsgroup, and found your posts. I don't know why they
don't show up in my Outlook reader, but they don't. I got your solution
Cor, and it does look amazingly simple! I am in the process of trying it
now, and I will let you know of the results. I just wanted to say thank
you, and Since I couldn't get my reader to come up with the most current
posts, I started a new thread.

I will let you know how it works, and again THANKS!

Coleen
Nov 21 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi Cor, I'm still testing this but I do have a question. The 2nd to last
line of code you have "Fig * 100/" & sum.tostring. Won't this give me the
same error that I have been getting all along, because the grand total has
not been calculated at the time that I need to use it to do the division?
I've been getting an "Infinity" error....
\\\
Private Sub Form1_Load(ByVal sender As _
Object, ByVal e As System.EventArgs) _
Handles MyBase.Load
Dim dt As New DataTable("Coleen")
dt.Columns.Add("Fig", GetType(System.Int32))
dt.Columns.Add("Perc", GetType(System.Int32))
For i As Integer = 0 To 5
Dim dr As DataRow = dt.NewRow
dr(0) = i + 1
dt.Rows.Add(dr)
Next
Dim dr2 As DataRow = dt.NewRow
Dim sum As Integer = _
CInt(dt.Compute("Sum(Fig)", ""))
dr2(0) = sum
dt.Rows.Add(dr2)
dt.Columns(1).Expression = _
"Fig * 100/ " & sum.ToString
DataGrid1.DataSource = dt
End Sub
///
"Coleen" <co**********@yaho.com> wrote in message
news:uI**************@TK2MSFTNGP10.phx.gbl...
Hi All :-)

Cor & David, Thank you for your help, sorry I did not reply before now, but for some reason my Newsgroup Reader (Outlook) does not show your last posts. The last one I got from Cor was asking me to clarify what I needed. I
checked in the Web Newsgroup, and found your posts. I don't know why they
don't show up in my Outlook reader, but they don't. I got your solution
Cor, and it does look amazingly simple! I am in the process of trying it
now, and I will let you know of the results. I just wanted to say thank
you, and Since I couldn't get my reader to come up with the most current
posts, I started a new thread.

I will let you know how it works, and again THANKS!

Coleen

Nov 21 '05 #2

P: n/a
Coleen,

When I open a new form,
drag a datagrid on it.
paste in the code I get

1|5
2|10
3|14
4|19
5|24
6|19
21|100

So I am curious how it can be with you in another way?

Cor

Nov 21 '05 #3

P: n/a
When I open a form, drag a grid onto it, I get nothing...no datagrid
populates, and the datagrid does not render. I've done a complete copy/paste
of your code, with one exception. I had to change the line of:
For i as Integer = 0 to 5 to:
dim i as integer
for i = 0 to 5

What version of VB .Net are you using? I know that should not make a
difference, but we use Microsoft Development 2002 Version 7.0.9466, .Net
Framework v. 1.0.3705. I don't think it should make a difference that I had
to dim the i as an integer in a separate line. But when I run the project,
nothing renders. Do I need to call the Form1_Load sub in the page load?
BTW, I'm using an Web form, not a Windows form...as a matter of fact, I'm
using web forms for all of my projects. Maybe that is why the code works
for you and not me?

Thanks for you help :-)

Please let me know if there is something different I need to do in the Web
form vs. the Windows form...

Coleen

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Coleen,

When I open a new form,
drag a datagrid on it.
paste in the code I get

1|5
2|10
3|14
4|19
5|24
6|19
21|100

So I am curious how it can be with you in another way?

Cor

Nov 21 '05 #4

P: n/a
Coleen,

I was expecting you where using a windowforms

However do what you did and add this as last sentence then the result is the
same as with a webform
DataGrid1.DataBind()

Cor
When I open a form, drag a grid onto it, I get nothing...no datagrid
populates, and the datagrid does not render. I've done a complete copy/paste of your code, with one exception. I had to change the line of:
For i as Integer = 0 to 5 to:
dim i as integer
for i = 0 to 5

What version of VB .Net are you using? I know that should not make a
difference, but we use Microsoft Development 2002 Version 7.0.9466, .Net
Framework v. 1.0.3705. I don't think it should make a difference that I had to dim the i as an integer in a separate line. But when I run the project, nothing renders. Do I need to call the Form1_Load sub in the page load?
BTW, I'm using an Web form, not a Windows form...as a matter of fact, I'm
using web forms for all of my projects. Maybe that is why the code works
for you and not me?

Thanks for you help :-)

Please let me know if there is something different I need to do in the Web
form vs. the Windows form...

Coleen

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Coleen,

When I open a new form,
drag a datagrid on it.
paste in the code I get

1|5
2|10
3|14
4|19
5|24
6|19
21|100

So I am curious how it can be with you in another way?

Cor


Nov 21 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.