Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > .NET 4 and Visual Studio 2010 > .NET 4 and Visual Studio 2010 General Discussions
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
.NET 4 and Visual Studio 2010 General Discussions For discussing anything about .NET 4, WPF, WCF, the rest of the .NET 4 Framework, and Visual Studio 2010 that isn't about a specific Wrox book. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the .NET 4 and Visual Studio 2010 General Discussions section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #11 (permalink)  
Old November 16th, 2012, 06:42 AM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Location: Healing, UK
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

Hi,

Sorry, have only just picked this up.

To save data from a DataGridView you need to lean how to Data Bind a Dataset or a DataTable to the DataGridView. This is a big subject in itself and typically implies interaction with Databases such as SQL Server, MySQL etc.

If you are looking for a quick fix then your best option would be to bind a DataSet to the DataGridView and then use the DataSet's Readxml and Writexml methods to read and write your information to a file on your local machine.

Hope that helps.

Cheers,

Ian
  #12 (permalink)  
Old November 16th, 2012, 12:56 PM
Registered User
Points: 34, Level: 1
Points: 34, Level: 1 Points: 34, Level: 1 Points: 34, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

first, i create the table using microsoft access.

then, i create the link between vb and the table

after that, i just drag the table from the database explorer

and usually when the table will show automatically in datagridview with the 'binding navigator'

usually i will use the code 'bindingnavigatorsaveitem.performclick()'

and it worked well.

But unfortunately this time, i have accidentally deleted the binding navigator.
ive tried to find it including at the panel below the formvb[design] but it wast there.

so what should i do in order for me to be able to use 'bindingnavigatorsaveitem.performclick()' code the again?
  #13 (permalink)  
Old November 16th, 2012, 11:50 PM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Location: Healing, UK
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

Hi,

The easiest way would be to delete the controls added to your form when you dragged the Table to the form, then delete the DataGridView and then just re-drag the Table back to your form. The IDE should then re-create the binding controls as necessary.

Cheers,

Ian
  #14 (permalink)  
Old November 28th, 2012, 02:30 AM
Registered User
Points: 34, Level: 1
Points: 34, Level: 1 Points: 34, Level: 1 Points: 34, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you very much Ian
u r really being very helpful

Do u know to make a value to highest ten?

for example, 43 to 50
47 also to 50
  #15 (permalink)  
Old December 10th, 2012, 10:54 PM
Authorized User
Points: 257, Level: 5
Points: 257, Level: 5 Points: 257, Level: 5 Points: 257, Level: 5
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2012
Location: Healing, UK
Posts: 59
Thanks: 2
Thanked 4 Times in 4 Posts
Default

Hi,

Been on holiday for a while so have only just picked this up. If you still need to know how to do this then the simplest method would be to use Integer Division to work out a number to the highest value of ten. Try This example:-

Code:
Const Ten As Integer = 10
Dim SampleValue As Integer = 47
Dim IntDivByTen As Integer

'use integer division to return the whole number
'of tens in the sample number
IntDivByTen = SampleValue \ Ten

'add one to the returned value to get the highest factor of ten
'and then multiply by ten
MsgBox((IntDivByTen + 1) * Ten)
Hope that helps.

Cheers,

Ian
The Following User Says Thank You to Ian Ryder For This Useful Post:
cole11 (January 21st, 2014)
  #16 (permalink)  
Old February 16th, 2013, 01:14 PM
Registered User
Points: 34, Level: 1
Points: 34, Level: 1 Points: 34, Level: 1 Points: 34, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Nov 2012
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hye,,, happy new year 2013 :p

i have a question

i have two datagridviews in my program (VB 2010) , datagridview A and datagridview B.

How can i program it so that whatever appears at datagridview A will automatically appear at datagridview B? ex: when i type the letter 'G' at datagridview A, the letter 'G' will also appear at datagridview B automatically.


thank you :)
  #17 (permalink)  
Old May 9th, 2013, 05:58 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2013
Posts: 1
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Ian Ryder View Post
Hi,

You can do this will the following code:-

Code:
Dim totalValue As Integer
For Each dgvRow As DataGridViewRow In DataGridView1.Rows
  If Not dgvRow.IsNewRow Then
    totalValue += CInt(dgvRow.Cells(1).Value)
  End If
Next
MsgBox(totalValue)
Hope that helps.

Cheers,

Ian
Man Ian, I just registered to say thank you ! I'm a student working on a college project and you have saved me hours and hours with that code. I've been trying for almost 2 days to calculate totals based on gridviews and thanks to you I have completed that part. Thanks a lot!!!
  #18 (permalink)  
Old January 21st, 2014, 04:11 PM
Registered User
Points: 3, Level: 1
Points: 3, Level: 1 Points: 3, Level: 1 Points: 3, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2014
Posts: 1
Thanks: 1
Thanked 0 Times in 0 Posts
Talking

Quote:
Originally Posted by Ian Ryder View Post
Hi,

You can do this will the following code:-

Code:
Dim totalValue As Integer
For Each dgvRow As DataGridViewRow In DataGridView1.Rows
  If Not dgvRow.IsNewRow Then
    totalValue += CInt(dgvRow.Cells(1).Value)
  End If
Next
MsgBox(totalValue)
Hope that helps.

Cheers,

Ian
good day sir, how can i change the msgbox to label or txtbox. i want to display the result in label or txtbox, not in msgbox. BIG thanks to you
  #19 (permalink)  
Old March 21st, 2014, 12:29 PM
Registered User
Points: 8, Level: 1
Points: 8, Level: 1 Points: 8, Level: 1 Points: 8, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Mar 2014
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to compute the total in datagridview

you can try this as well

Private Sub DataGridView1_CellEnter(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles DataGridView1.CellEnter

Try

Dim icell1 As Integer = 0
Dim icell2 As Integer = 0
Dim icellResult As Integer = 0
icell1 = DataGridView1.CurrentRow.Cells(1).Value
icell2 = DataGridView1.CurrentRow.Cells(2).Value
icellResult = icell1 * icell2
DataGridView1.CurrentRow.Cells(3).Value = icellResult.ToString()

Catch ex As Exception

End Try

End Sub
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
New to VB 2010 - I need help with OLEDB toconce Visual Basic 2010 General Discussion 10 May 25th, 2015 03:10 AM
Moving up from VB5 to VB 2010 VB2010Newbie Visual Basic 2010 General Discussion 5 June 17th, 2011 09:33 AM
Trouble getting form to appear - VB 2010 jericho Visual Basic 2010 General Discussion 1 June 6th, 2011 06:50 AM
Beginning Microsoft VB 2010 Tony1997 .NET 4 and Visual Studio 2010 General Discussions 2 April 3rd, 2011 11:19 AM
Sum of numbers that was insert will automatic compute and appear in total text field newphpcoder PHP Databases 0 December 23rd, 2010 02:34 AM



All times are GMT -4. The time now is 09:39 PM.


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