Imports DevExpress.XtraGrid

Public Class frmDocTest
    Private Sub DocTest_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Try
            Dim oControlPatcher = New ClassControlPatcher(Of GridControl)(Me)
            oControlPatcher.
                ProcessContainer(AddressOf GridControlDefaults.DefaultGridSettings).
                ProcessContainer(AddressOf GridControlDefaults.ReadOnlyGridSettings)

            Dim oSQL = "SELECT * FROM VWIDB_DOC_METADATA_DE"
            My.Channel.CreateDatabaseRequest("Load Doc Values", True)

            Dim oResult = My.Channel.ReturnDatatable(oSQL)

            If Not oResult.OK Then
                MsgBox(oResult.ErrorMessage)
                Exit Sub
            End If

            My.Channel.CloseDatabaseRequest()

            Dim oDatatable As DataTable = oResult.Table

            txtDoctype.DataBindings.Add(New Binding("Text", oDatatable, "DOCTYPE"))
            txtDocId.DataBindings.Add(New Binding("Text", oDatatable, "DOC_ID"))

            GridControl1.DataSource = oDatatable
        Catch ex As Exception
            ShowErrorMessage(ex)
        End Try
    End Sub

    Private Async Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim oDocId As Int64 = Int64.Parse(txtDocId.Text)
        Dim oValue As String = txtDoctype.Text
        Dim oSyskey As String = "001-DOCTYPE"
        Dim oResult = Await My.Common.Commands.FNIDB_NEW_DOC_VALUE(oDocId, oSyskey, My.Application.User.Language, oValue)

        If Not oResult.OK Then
            MsgBox(oResult.ErrorMessage)
            Exit Sub
        End If

        My.Channel.CloseDatabaseRequest()
    End Sub
End Class