Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > General > auto update a txtbox with a column in dataGrid


Reply
 
Thread Tools Display Modes
  #1  
Old 02-21-2004, 02:55 PM
Tailgun Tailgun is offline
Newcomer
 
Join Date: Jan 2004
Location: Conyers, Georgia
Posts: 17
Question auto update a txtbox with a column in dataGrid


I have a datagrid that the user can edit, delete. add etc and it works fine.

The total from one currency column needs to be automaticly updated after the user makes changes and he clicks a Save cmdbutton. At the moment with this code I can only make it work by using a seperate command button to update the total. I would like to do it without using another cmdbutton to update the total. The error I get if I include the code anywhere else is you cannot add a empty row. Hopefully someone can show me how to modifiy this code.



visual basic code:
If Adodc2.Recordset.RecordCount <> 0 And Adodc2.Recordset.BOF = False And Adodc2.Recordset.EOF = False Then
Dim fmtCurr As New StdDataFormat
fmtCurr.Format = "Currency"
Set DataGrid1.Columns(1).DataFormat = fmtCurr
Dim rs As ADODB.Recordset
Dim dSum As Double
Set rs = Adodc2.Recordset.Clone


rs.MoveFirst
Do Until rs.EOF
If IsNumeric(rs("ValueChgOrder")) Then _
dSum = dSum + rs("ValueChgOrder")
rs.MoveNext
Loop

Set rs = Nothing

txtTotal.Text = FormatCurrency(dSum)
Else
txtTotal.Text = ""

End If


Thanks for any and all help
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filling invisible column in DataGrid Batch Update RStanford Database and Reporting 1 02-18-2004 07:59 AM
Datagrid column update behaviour gajit Database and Reporting 1 04-30-2003 08:49 AM
datagrid update limited to current max string in column klook Database and Reporting 0 11-13-2002 08:39 PM
Pausing VBA after a Shell Command matt_wendling Word, PowerPoint, Outlook, and Other Office Products 10 10-10-2001 09:07 AM
VB Help jdn6705 General 4 02-27-2001 01:50 PM

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->