Devexspress Общее количество ошибок в gridview - PullRequest
0 голосов
/ 05 мая 2020

В моем проекте было 2 проблемы. Используя событие CustomDrawCell от devexspress Gridview, я помечаю ячейки с ошибками, как показано на рисунке ниже. Но когда я нажимаю кнопку NEXT в конце процесса Column 1 4 error Column 3 1 error Как мне заставить его предупредить вроде. Я просмотрел errorprovider, но не получил никаких результатов для vb. net.

и 2-й вопрос Как я могу получить значение, если ячейка, которую я щелкнул, неверна? Я не могу получить его с этим кодом мои коды подключения

Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Imports DevExpress.XtraEditors.DXErrorProvider
Imports DevExpress.XtraGrid.Views.Base
Imports DevExpress.XtraGrid.Views.Grid
Imports DevExpress.XtraGrid.Views.Grid.ViewInfo
Public Class Form1
    Dim dt As New DataTable
    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        With dt
            .Columns.Add("ID", GetType(Integer))
            .Columns.Add("Name", GetType(String))
        End With

        With dt
            .Rows.Add("1", "2")
            .Rows.Add("-1", " ")
            .Rows.Add("1", "Name")
        End With
        GridControl1.DataSource = dt
    End Sub

    Private Sub GridView1_CustomDrawCell(sender As Object, e As RowCellCustomDrawEventArgs) Handles GridView1.CustomDrawCell
        Dim View As GridView = TryCast(sender, GridView)
        Dim cellInfo As GridCellInfo = TryCast(e.Cell, GridCellInfo)
        If e.Column.FieldName = "ID" Then
            Dim a As Integer = CInt(e.CellValue)
            If a < 0 Then
                cellInfo.ViewInfo.ShowErrorIcon = True
            End If
        ElseIf e.Column.FieldName = "Name" Then
            cellInfo.ViewInfo.ShowErrorIcon = True
               End If
    End Sub
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...