I’ve been trying to use Infragistics.Win.UltraWinGrid, Infragistics.Win, Infragistics.Shared to filter my EpiUltraGrid and hopefully select the top displayed grid row as active and also select it. I’ve tried to use Grid Filters and save the layout, but an active row is still present that’s outside of my filter. Here I’ll attach my code. I understand a lot of it is overlapped, but I can’t seem to form a connection with my EpiUltraGrid even with it’s GUID. Here I’ll attach the “All Code” as a PDF : partTrackerCode.pdf (2.1 MB)
Imports System
Imports System.ComponentModel
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports Erp.Adapters
Imports Erp.UI
Imports Ice.Lib
Imports Ice.Adapters
Imports Ice.Lib.Customization
Imports Ice.Lib.ExtendedProps
Imports Ice.Lib.Framework
Imports Ice.Lib.Searches
Imports Ice.UI.FormFunctions
Imports Infragistics.Win.UltraWinGrid
Imports Infragistics.Win
Imports Infragistics.Shared
Imports System.Drawing
Public Class Script
Private local5 As EpiUltraGrid ' Declare the EpiUltraGrid variable
Private sbfilename As EpiDataView ' Declare the EpiDataView variable
Public Property ActiveCellAppearance As Infragistics.Win.AppearanceBase
' ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
' Begin Wizard Added Module Level Variables **
' End Wizard Added Module Level Variables **
' Add Custom Module Level Variables Here **
Public Sub InitializeCustomCode()
' ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
' Begin Wizard Added Variable Initialization
' End Wizard Added Variable Initialization
' Begin Wizard Added Custom Method Calls
AddHandler Me.epiButtonC1.Click, AddressOf Me.epiButtonC1_Click
' End Wizard Added Custom Method Calls
Dim personalizeCustomizeManager As Ice.Lib.Customization.PersonalizeCustomizeManager = Me.csm.PersonalizeCustomizeManager
Dim local5 As Ice.Lib.Framework.EpiUltraGrid = CType(personalizeCustomizeManager.ControlsHT("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"),Ice.Lib.Framework.EpiUltraGrid)
'local5 = CType(csm.GetNativeControlReference("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"),Ice.Lib.Framework.EpiUltraGrid)
'local5 = CType(personalizeCustomizeManager.ControlsHT("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"), Ice.Lib.Framework.EpiUltraGrid)
'local5.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False
'local5.DisplayLayout.Override.SelectedAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False
'local5.DeleteSelectedRows()
'local5.Focus()
'local5.PerformAction(UltraGridAction.ActivateCell)
End Sub
Public Sub DestroyCustomCode()
' ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
' Begin Wizard Added Object Disposal
RemoveHandler Me.epiButtonC1.Click, AddressOf Me.epiButtonC1_Click
' End Wizard Added Object Disposal
' Begin Custom Code Disposal
' End Custom Code Disposal
End Sub
Private Sub btnEpiCustom2_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles btnEpiCustom2.Click
'// ** Place Event Handling Code Here **
Dim draw as string
dim sbdrawnum as string = ""
Dim sbfilename As EpiDataView = CType(oTrans.EpiDataViews("PartRev"), EpiDataView)
If (sbfilename.dataview.count > 0 and sbfilename.row >= 0) then
sbdrawnum = sbfilename.dataView(sbfilename.Row)("DrawNum")
End if
' dim newstring as string
' if (sbdrawnum.Length > 11) Then
' else
' newstring = sbdrawnum.replace("-", "")
' sbdrawnum = newstring
' End If
If (sbdrawnum.Length > 0) Then
'messagebox.show(sbdrawnum.ToString())
draw = "F:\DWF\" & sbdrawnum & ".dwg.dwf"
process.start("c:\program files\autodesk\autodesk design review\designreview.exe", draw)
'If local5 IsNot Nothing Then
'local5.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.IndianRed
'If local5.Rows.Count > 0 Then
' local5.Rows(0).Activate() ' Programmatically set the active row
' End If
'End If
Else
MessageBox.Show("Part has no drawing number")
End If
End Sub
Private Sub epiButtonC1_Click(ByVal sender As Object, ByVal args As System.EventArgs)
' ** Place Event Handling Code Here **
Dim sbfilename As EpiDataView = CType(oTrans.EpiDataViews("PartRev"), EpiDataView)
' Check if there are any rows in the data view
If sbfilename IsNot Nothing AndAlso sbfilename.dataView IsNot Nothing AndAlso sbfilename.dataView.Count > 0 Then
' Get the index of the last row
Dim lastIndex As Integer = sbfilename.dataView.Count - 1
' Delete the last row
sbfilename.dataView.Delete(lastIndex)
End If
End Sub
End Class
Does this look better? I don’t know how to run any tests. Should I do any Trace logging or BPM’s?
' **************************************************
' Custom code for PartTrackerForm
' Created: 7/17/2023 1:24:48 PM
' **************************************************
Imports System
Imports System.ComponentModel
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports Microsoft.VisualBasic
Imports Erp.Adapters
Imports Erp.UI
Imports Ice.Lib
Imports Ice.Adapters
Imports Ice.Lib.Customization
Imports Ice.Lib.ExtendedProps
Imports Ice.Lib.Framework
Imports Ice.Lib.Searches
Imports Ice.UI.FormFunctions
Imports Infragistics.Win.UltraWinGrid
Imports Infragistics.Win
Imports Infragistics.Shared
Imports System.Drawing
Public Class Script
Private local5 As Ice.Lib.Framework.EpiUltraGrid ' Declare the EpiUltraGrid variable
Private sbfilename As Ice.Lib.Framework.EpiDataView ' Declare the EpiDataView variable
Public Property ActiveCellAppearance As Infragistics.Win.AppearanceBase
' ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
' Begin Wizard Added Module Level Variables **
' End Wizard Added Module Level Variables **
' Add Custom Module Level Variables Here **
Public Sub InitializeCustomCode()
' ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Initialization' lines **
' Begin Wizard Added Variable Initialization
' End Wizard Added Variable Initialization
' Begin Wizard Added Custom Method Calls
AddHandler Me.epiButtonC1.Click, AddressOf Me.epiButtonC1_Click
Dim personalizeCustomizeManager As Ice.Lib.Customization.PersonalizeCustomizeManager = Me.csm.PersonalizeCustomizeManager
Dim local2 As Ice.Lib.Framework.EpiBaseForm = CType(personalizeCustomizeManager.ControlsHT("2dcd1674-5e34-4d98-b493-c75747027376"), Ice.Lib.Framework.EpiBaseForm)
AddHandler local2.Load, AddressOf PartTrackerForm_Load
AddHandler local2.Shown, AddressOf PartTrackerForm_Shown
' End Wizard Added Custom Method Calls
'Dim personalizeCustomizeManager As Ice.Lib.Customization.PersonalizeCustomizeManager = Me.csm.PersonalizeCustomizeManager
'Dim local5 As Ice.Lib.Framework.EpiUltraGrid = CType(personalizeCustomizeManager.ControlsHT("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"),Ice.Lib.Framework.EpiUltraGrid)
'local5 = CType(csm.GetNativeControlReference("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"),Ice.Lib.Framework.EpiUltraGrid)
'local5 = CType(personalizeCustomizeManager.ControlsHT("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"), Ice.Lib.Framework.EpiUltraGrid)
'Me.Filter_Row = CType(Me.csm.GetGlobalInstance("Filter_Row"), Ice.Lib.Framework.EpiDataView)
'Me.Filter_Row.ActiveRow = Nothing
'Me.Revisions_Row = CType(Me.csm.GetGlobalInstance("Revisions_Row"), Ice.Lib.Framework.EpiDataView)
'Me.Revisions_Row.ActiveRow = Nothing
'local5.DisplayLayout.Override.ActiveAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False
'local5.DisplayLayout.Override.SelectedAppearancesEnabled = Infragistics.Win.DefaultableBoolean.False
'local5.DeleteSelectedRows()
'local5.Focus()
'local5.PerformAction(UltraGridAction.ActivateCell)
End Sub
Public Sub DestroyCustomCode()
' ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
' Begin Wizard Added Object Disposal
RemoveHandler Me.epiButtonC1.Click, AddressOf Me.epiButtonC1_Click
' End Wizard Added Object Disposal
' Begin Custom Code Disposal
' End Custom Code Disposal
End Sub
Private Sub btnEpiCustom2_Click(ByVal Sender As Object, ByVal Args As System.EventArgs) Handles btnEpiCustom2.Click
'// ** Place Event Handling Code Here **
Dim draw as string
dim sbdrawnum as string = ""
Dim sbfilename As EpiDataView = CType(oTrans.EpiDataViews("PartRev"), EpiDataView)
If (sbfilename.dataview.count > 0 and sbfilename.row >= 0) then
sbdrawnum = sbfilename.dataView(sbfilename.Row)("DrawNum")
End if
' dim newstring as string
' if (sbdrawnum.Length > 11) Then
' else
' newstring = sbdrawnum.replace("-", "")
' sbdrawnum = newstring
' End If
If (sbdrawnum.Length > 0) Then
'messagebox.show(sbdrawnum.ToString())
draw = "F:\DWF\" & sbdrawnum & ".dwg.dwf"
process.start("c:\program files\autodesk\autodesk design review\designreview.exe", draw)
Else
MessageBox.Show("Part has no drawing number")
End If
End Sub
Private Sub epiButtonC1_Click(ByVal sender As Object, ByVal args As System.EventArgs)
' ** Place Event Handling Code Here **
Dim sbfilename As EpiDataView = CType(oTrans.EpiDataViews("PartRev"), EpiDataView)
' Check if there are any rows in the data view
If sbfilename IsNot Nothing AndAlso sbfilename.dataView IsNot Nothing AndAlso sbfilename.dataView.Count > 0 Then
' Get the index of the last row
Dim lastIndex As Integer = sbfilename.dataView.Count - 1
' Delete the last row
sbfilename.dataView.Delete(lastIndex)
End If
End Sub
Private Sub PartTrackerForm_Load(ByVal sender As Object, ByVal args As EventArgs)
' Add Event Handler Code
Dim form As Form = CType(sender, Form)
Dim local5 As Ice.Lib.Framework.EpiUltraGrid = CType(form.Controls("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"), Ice.Lib.Framework.EpiUltraGrid)
If local5 IsNot Nothing AndAlso TypeOf local5 Is Ice.Lib.Framework.EpiUltraGrid Then
' local5 is an instance of EpiUltraGrid
MessageBox.Show("local5 is an instance of EpiUltraGrid")
local5.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.IndianRed
local5.DisplayLayout.Override.SelectedAppearancesEnabled = DefaultableBoolean.False
local5.Selected.Rows.Clear() ' Deselect all rows
local5.ActiveRow = Nothing ' Deactivate any active row
local5.ActiveCell = Nothing ' Deactivate any active cell
local5.Update() ' Update the grid to reflect the changes
Else
' local5 is not an instance of EpiUltraGrid
MessageBox.Show("local5 is not an instance of EpiUltraGrid")
End If
End Sub
Private Sub PartTrackerForm_Shown(ByVal sender As Object, ByVal args As EventArgs)
' Additional code to handle grid or form after it is shown
' Access the form and grid
Dim form As Form = CType(sender, Form)
Dim local5 As Ice.Lib.Framework.EpiUltraGrid = CType(form.Controls("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"), Ice.Lib.Framework.EpiUltraGrid)
' Perform custom actions with the grid or form
If local5 IsNot Nothing AndAlso TypeOf local5 Is Ice.Lib.Framework.EpiUltraGrid Then
' Custom grid manipulation or interaction
' Example: Set the active row or perform some action on the grid
local5.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.IndianRed
local5.DisplayLayout.Override.SelectedAppearancesEnabled = DefaultableBoolean.False
local5.Selected.Rows.Clear() ' Deselect all rows
local5.ActiveRow = Nothing ' Deactivate any active row
local5.ActiveCell = Nothing ' Deactivate any active cell
local5.Update() ' Update the grid to reflect the changes
' Additional custom actions with the grid
' ...
End If
' Additional custom actions with the form
' ...
End Sub
End Class
Thank you for your patience. I did recieve a message saying “local5 is not an instance of EpiUltraGrid” This is for a Part Tracker form so I’d assume a Part Num needs selected first
If local5 IsNot Nothing AndAlso TypeOf local5 Is Ice.Lib.Framework.EpiUltraGrid Then
’ local5 is an instance of EpiUltraGrid
MessageBox.Show(“local5 is an instance of EpiUltraGrid”)
local5.DisplayLayout.Override.ActiveRowAppearance.BackColor = Color.IndianRed
local5.DisplayLayout.Override.SelectedAppearancesEnabled = DefaultableBoolean.False
local5.Selected.Rows.Clear() ' Deselect all rows
local5.ActiveRow = Nothing ' Deactivate any active row
local5.ActiveCell = Nothing ' Deactivate any active cell
local5.Update() ' Update the grid to reflect the changes
Else
' local5 is not an instance of EpiUltraGrid
MessageBox.Show("local5 is not an instance of EpiUltraGrid")
End If
This will get you the reference you need. Tested and works.
The rest of your code I haven’t looked at.
Public Class Script
Private local5 As EpiUltraGrid ' Declare the EpiUltraGrid variable
Public Sub InitializeCustomCode()
local5 = CType(csm.GetNativeControlReference("86fb7bf3-f52e-4d9a-9d96-30551ee51ecf"), Ice.Lib.Framework.EpiUltraGrid)