此VB.Net代码做什么 [英] What does this VB.Net Code Do

查看:68
本文介绍了此VB.Net代码做什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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.

推荐答案

它会检查用户每次单击DGV中的单元格时是否单击了哪个列和行.根据在各列中找到的信息,它会弹出一个文件对话框并复制文件.

恕我直言,这段代码编写得不好,不应该用于生产目的,也不应该用作学习工具来教你任何有用的东西.
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.


这篇关于此VB.Net代码做什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆