Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > ADO.NET
|
ADO.NET For discussion about ADO.NET.  Topics such as question regarding the System.Data namespace are appropriate.  Questions specific to a particular application should be posted in a forum specific to the application .
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ADO.NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 17th, 2007, 06:39 AM
4x4 4x4 is offline
Registered User
 
Join Date: Nov 2006
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problem computing in DataGridView

I have a dataGridView bound to a dataTable with columns like

Ticket_Num_From Ticket_Num_To Total_Tickets.

It is required that when Ticket_Num_To is filled by user Total_Tickets column get automatically calculated
(Ticket_Num_To - Ticket_Num_From + 1).

I have tried it on ColumnChanged event of dataTable but with limited success.

If somebody could help me on this pls.

Many thanks in advance.
 
Old January 19th, 2007, 02:20 PM
Registered User
 
Join Date: Jan 2007
Posts: 6
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to ajaidass
Default

int a, b;
private void dataGridView1_CellValueChanged(object sender, DataGridViewCellEventArgs e)
    {

            b = (dataGridView1.CurrentRow.Index);
            if ((dataGridView1.Rows[b].Cells[0].Value) != null)
            {
                if (dataGridView1.CurrentCell.ColumnIndex==0)
                {
                        a=Convert.ToInt32(dataGridView1.Rows[b].Cells[0].Value);
                        b=convert.ToInt32(dataGridView1.Rows[b].Cells[1].Value);
            dataGridView1.Rows[b].Cells[2].Value=(a-b)+1;
                }
            }


    }





Similar Threads
Thread Thread Starter Forum Replies Last Post
SQL - Computing percentage of total ace2e SQL Language 8 October 31st, 2014 10:42 AM
Problem with DataGridView rgassociate Visual Studio 2005 0 January 26th, 2007 06:10 PM
DataGridView Problem bipulbasakdhaka Visual Basic 2005 Basics 0 November 8th, 2006 01:34 AM
General 'Computing' discussion forum crmpicco HTML Code Clinic 2 August 31st, 2005 08:19 AM
upcoming features abt Mobile Computing Tanvi Visual Studio 2005 0 September 27th, 2004 08:23 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.