|
-
Nov 19th, 2013, 08:15 PM
#1
Thread Starter
Junior Member
How To Fill Datagridview Colomn From Another Datagridview
-
Nov 20th, 2013, 09:55 AM
#2
Re: How To Fill Datagridview Colomn From Another Datagridview
Hi,
You have shown some pseudo code there but what have you actually tried so far? You would be better off doing this with the underlying DataSource otherwise you need to follow along the lines of something like this:-
1) Create a For Loop to iterate through the Rows of your First DataGridView to get each row. Make sure you ignore the NewRow at the end of the DataGridView.
2) For each Row in the above For loop you need to find the corresponding Row in the Second DataGridView. This can be done with another For Loop or with LINQ, whichever you prefer.
3) Once you have found the corresponding row in the second DataGridView you need to use your Case Statement to set the Value of the necessary Cell in the Second DataGridView.
That's it and give it a try.
Hope that helps.
Cheers,
Ian
-
Nov 22nd, 2013, 11:07 PM
#3
Thread Starter
Junior Member
Re: How To Fill Datagridview Colomn From Another Datagridview
I have been found my solution!
This is the code :
Code:
For i As Integer = 0 To dgvDataAwalMahasiswa.Rows.Count - 1
If dgvDataAwalMahasiswa.Rows(i).Cells(3).Value >= 3.75 Then
dgvMetodePanitiaMahasiswa.Rows(i).Cells(3).Value = 100
ElseIf dgvDataAwalMahasiswa.Rows(i).Cells(3).Value >= 3.5 And dgvDataAwalMahasiswa.Rows(i).Cells(3).Value < 3.75 Then
dgvMetodePanitiaMahasiswa.Rows(i).Cells(3).Value = 90
ElseIf dgvDataAwalMahasiswa.Rows(i).Cells(3).Value >= 3.25 And dgvDataAwalMahasiswa.Rows(i).Cells(3).Value < 3.5 Then
dgvMetodePanitiaMahasiswa.Rows(i).Cells(3).Value = 80
ElseIf dgvDataAwalMahasiswa.Rows(i).Cells(3).Value >= 3 And dgvDataAwalMahasiswa.Rows(i).Cells(3).Value < 3.25 Then
dgvMetodePanitiaMahasiswa.Rows(i).Cells(3).Value = 70
ElseIf dgvDataAwalMahasiswa.Rows(i).Cells(3).Value >= 2.75 And dgvDataAwalMahasiswa.Rows(i).Cells(3).Value < 3 Then
dgvMetodePanitiaMahasiswa.Rows(i).Cells(3).Value = 60
ElseIf dgvDataAwalMahasiswa.Rows(i).Cells(3).Value >= 2.5 And dgvDataAwalMahasiswa.Rows(i).Cells(3).Value < 2.75 Then
dgvMetodePanitiaMahasiswa.Rows(i).Cells(3).Value = 50
ElseIf dgvDataAwalMahasiswa.Rows(i).Cells(3).Value < 2.5 Then
dgvMetodePanitiaMahasiswa.Rows(i).Cells(3).Value = 0
End If
Next
Note :
dgvDataAwalMahasiswa = Datagridview1 [Where Data From]
dgvMetodePanitiaMahasiswa = Datagridview2 [Destination Of Data]
To Do This, Datagridview1 and Datagridview2 Must Have Same Rows!
Thanks Ian Ryder
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|