Click here to Skip to main content
15,914,348 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
VB
Private Sub QuotationsDataGridView_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles QuotationsDataGridView.CellClick

        If e.RowIndex < 0 OrElse Not e.ColumnIndex = QuotationsDataGridView.Columns(3).Index Then
            If e.RowIndex < 0 OrElse Not e.ColumnIndex = QuotationsDataGridView.Columns(4).Index Then
            Else
                For Each roww As DataGridViewRow In Me.QuotationsDataGridView.Rows
                    If roww.Cells(0).Value = Me.QuotationsDataGridView.CurrentRow.Cells(0).Value Then
                        roww.Cells(4).Value = False
                    End If
                Next
            End If
        Else
            Try
                If OpenFileDialog1.ShowDialog = Windows.Forms.DialogResult.OK Then
                    QuotationsDataGridView.Rows(e.RowIndex).Cells(3).Value = OpenFileDialog1.SafeFileName
                    My.Computer.FileSystem.CopyFile(OpenFileDialog1.FileName, path("Quotations") & "\" & OpenFileDialog1.SafeFileName)
                    audit("Attached quotation to  Purchase request no " & QuotationsDataGridView.Rows(e.RowIndex).Cells(0).Value)
                End If

            Catch ex As Exception

            End Try
        End If
    End Sub


Explain what this code does step by step. I will sincerly appreciate your help.
Posted
Updated 18-Nov-10 3:59am
v3
Comments
Dalek Dave 18-Nov-10 4:17am    
Edited for Code Block
Sunasara Imdadhusen 18-Nov-10 6:56am    
Where you are facing problem to understand?
#realJSOP 18-Nov-10 10:00am    
Seriously? You can't even analyze the code you're using? How do you expect to succeed as a programmer?

1 solution

It's checking to see which column and row the user clicked in every time they click a cell in the DGV. Based on information found in various columns, it's putting up a File Dialog and copying a file.

IMHO, this is code that is poorly written and should not be used for production purposes, nor used as a learning tool to teach you anything useful.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900