Eug - Is it possible to add a field to a Collection?

Hi bw2868bond,

Thanks!

I just got back to this old project.
Your example worked great.


--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> Here is even an older example for the Time Phase lookup screen:
>
> '//**************************************************
> '// Custom VB.NET code for TimePhasForm
> '// Created: 8/22/2007 8:55:46 AM
> '//**************************************************
> Imports System
> Imports System.Data
> Imports System.Diagnostics
> Imports System.Windows.Forms
> Imports System.ComponentModel
> Imports Microsoft.VisualBasic
> Imports Epicor.Mfg.UI
> Imports Epicor.Mfg.UI.FrameWork
> Imports Epicor.Mfg.UI.ExtendedProps
> Imports Epicor.Mfg.UI.FormFunctions
> Imports Epicor.Mfg.UI.Customization
> Imports Epicor.Mfg.UI.Adapters
> Imports Epicor.Mfg.UI.Searches
> Imports Epicor.Mfg.BO
>
>
> Module Script
>
>
> '// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
> '// Begin Wizard Added Module Level Variables **
>
> Private WithEvents edvTimePhas As EpiDataView
> '// End Wizard Added Module Level Variables **
>
>
> '// Add Custom Module Level Variables Here **
>
>
>
> Sub InitializeCustomCode()
>
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
> '// Begin Wizard Added Variable Intialization
>
> edvTimePhas = CType(oTrans.EpiDataViews("TimePhas"), EpiDataView)
> '// End Wizard Added Variable Intialization
> '// Begin Custom Method Calls
>
> If Not (edvTimePhas.dataView.Table.Columns.Contains("ParentPart")) Then
> edvTimePhas.dataView.Table.Columns.Add(new DataColumn("ParentPart"))
> End If
> '// End Custom Method Calls
> End Sub
>
>
>
> Sub DestroyCustomCode()
>
>
> '// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
> '// Begin Wizard Added Object Disposal
>
> '// End Wizard Added Object Disposal
> '// Begin Custom Code Disposal
>
> '// End Custom Code Disposal
> End Sub
>
>
>
> Private Sub edvTimePhas_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvTimePhas.EpiViewNotification
> '// ** Argument Properties and Uses **
> '// view.dataView(args.Row)("[FieldName]")
> '// args.Row, args.Column, args.Sender, args.NotifyType
> '// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
> If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
> If (args.Row > -1) Then
> AddParentPart()
> End If
> End If
> End Sub
>
> Private Sub AddParentPart()
> For Each dr As DataRow In edvTimePhas.dataView.Table.Rows
> If Not IsDBNull(dr("JobNum")) Then
> dr("ParentPart") = getParentPart(dr("JobNum"))
> End If
> Next
> End Sub
>
> Private Function getParentPart(ByVal job As String) As String
> Dim parentPart As String
> Dim recordSelected As Boolean
> Dim showSearch As Boolean = False
> Dim whereClause As String = "JobNum = '" + job + "'"
> Dim dsJobInfo As DataSet = SearchFunctions.listLookup(TimePhasForm, "JobAsmSearchAdapter", recordSelected, showSearch, whereClause)
> If recordSelected Then
> parentPart = dsJobInfo.Tables(0).Rows(0)("PartNum").ToString()
> Else
> parentPart = ""
> End If
>
> Return parentPart
> End Function
>
>
>
>
> End Module
>
>
> --- In vantage@yahoogroups.com, "cooner_55421" <cooner_55421@> wrote:
> >
> > > You can add a column to the data view,
> > >but it will be empty until you put data into the column.
> >
> > Do you have any examples you can share?
> > I found one old thread with an example for receipt entry but I'm not having any luck with it.
> >
> > Thanks
> >
> > --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> > >
> > > You can add a column to the data view, but it will be empty until you put data into the column.
> > >
> > > The grid will automatically include the added column
> > >
> > > --- In vantage@yahoogroups.com, "cooner_55421" <cooner_55421@> wrote:
> > > >
> > > > Hi,
> > > >
> > > > Is it possible to add columns to Collections?
> > > > I am looking at a grid on a form.
> > > > The grid is bound to a native view.
> > > > The field I want to display in the grid isn't listed in the columns collection.
> > > >
> > > > Thanks
> > > >
> > >
> >
>
Hi,

Is it possible to add columns to Collections?
I am looking at a grid on a form.
The grid is bound to a native view.
The field I want to display in the grid isn't listed in the columns collection.

Thanks
You can add a column to the data view, but it will be empty until you put data into the column.

The grid will automatically include the added column

--- In vantage@yahoogroups.com, "cooner_55421" <cooner_55421@...> wrote:
>
> Hi,
>
> Is it possible to add columns to Collections?
> I am looking at a grid on a form.
> The grid is bound to a native view.
> The field I want to display in the grid isn't listed in the columns collection.
>
> Thanks
>
> You can add a column to the data view,
>but it will be empty until you put data into the column.

Do you have any examples you can share?
I found one old thread with an example for receipt entry but I'm not having any luck with it.

Thanks

--- In vantage@yahoogroups.com, "bw2868bond" <bwalker@...> wrote:
>
> You can add a column to the data view, but it will be empty until you put data into the column.
>
> The grid will automatically include the added column
>
> --- In vantage@yahoogroups.com, "cooner_55421" <cooner_55421@> wrote:
> >
> > Hi,
> >
> > Is it possible to add columns to Collections?
> > I am looking at a grid on a form.
> > The grid is bound to a native view.
> > The field I want to display in the grid isn't listed in the columns collection.
> >
> > Thanks
> >
>
Here is even an older example for the Time Phase lookup screen:

'//**************************************************
'// Custom VB.NET code for TimePhasForm
'// Created: 8/22/2007 8:55:46 AM
'//**************************************************
Imports System
Imports System.Data
Imports System.Diagnostics
Imports System.Windows.Forms
Imports System.ComponentModel
Imports Microsoft.VisualBasic
Imports Epicor.Mfg.UI
Imports Epicor.Mfg.UI.FrameWork
Imports Epicor.Mfg.UI.ExtendedProps
Imports Epicor.Mfg.UI.FormFunctions
Imports Epicor.Mfg.UI.Customization
Imports Epicor.Mfg.UI.Adapters
Imports Epicor.Mfg.UI.Searches
Imports Epicor.Mfg.BO


Module Script


'// ** Wizard Insert Location - Do Not Remove 'Begin/End Wizard Added Module Level Variables' Comments! **
'// Begin Wizard Added Module Level Variables **

Private WithEvents edvTimePhas As EpiDataView
'// End Wizard Added Module Level Variables **


'// Add Custom Module Level Variables Here **



Sub InitializeCustomCode()


'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Variable Intialization' lines **
'// Begin Wizard Added Variable Intialization

edvTimePhas = CType(oTrans.EpiDataViews("TimePhas"), EpiDataView)
'// End Wizard Added Variable Intialization
'// Begin Custom Method Calls

If Not (edvTimePhas.dataView.Table.Columns.Contains("ParentPart")) Then
edvTimePhas.dataView.Table.Columns.Add(new DataColumn("ParentPart"))
End If
'// End Custom Method Calls
End Sub



Sub DestroyCustomCode()


'// ** Wizard Insert Location - Do not delete 'Begin/End Wizard Added Object Disposal' lines **
'// Begin Wizard Added Object Disposal

'// End Wizard Added Object Disposal
'// Begin Custom Code Disposal

'// End Custom Code Disposal
End Sub



Private Sub edvTimePhas_EpiViewNotification(view As EpiDataView, args As EpiNotifyArgs) Handles edvTimePhas.EpiViewNotification
'// ** Argument Properties and Uses **
'// view.dataView(args.Row)("[FieldName]")
'// args.Row, args.Column, args.Sender, args.NotifyType
'// NotifyType.Initialize, NotifyType.AddRow, NotifyType.DeleteRow, NotifyType.InitLastView, NotifyType.InitAndResetTreeNodes
If (args.NotifyType = EpiTransaction.NotifyType.Initialize) Then
If (args.Row > -1) Then
AddParentPart()
End If
End If
End Sub

Private Sub AddParentPart()
For Each dr As DataRow In edvTimePhas.dataView.Table.Rows
If Not IsDBNull(dr("JobNum")) Then
dr("ParentPart") = getParentPart(dr("JobNum"))
End If
Next
End Sub

Private Function getParentPart(ByVal job As String) As String
Dim parentPart As String
Dim recordSelected As Boolean
Dim showSearch As Boolean = False
Dim whereClause As String = "JobNum = '" + job + "'"
Dim dsJobInfo As DataSet = SearchFunctions.listLookup(TimePhasForm, "JobAsmSearchAdapter", recordSelected, showSearch, whereClause)
If recordSelected Then
parentPart = dsJobInfo.Tables(0).Rows(0)("PartNum").ToString()
Else
parentPart = ""
End If

Return parentPart
End Function




End Module


--- In vantage@yahoogroups.com, "cooner_55421" <cooner_55421@...> wrote:
>
> > You can add a column to the data view,
> >but it will be empty until you put data into the column.
>
> Do you have any examples you can share?
> I found one old thread with an example for receipt entry but I'm not having any luck with it.
>
> Thanks
>
> --- In vantage@yahoogroups.com, "bw2868bond" <bwalker@> wrote:
> >
> > You can add a column to the data view, but it will be empty until you put data into the column.
> >
> > The grid will automatically include the added column
> >
> > --- In vantage@yahoogroups.com, "cooner_55421" <cooner_55421@> wrote:
> > >
> > > Hi,
> > >
> > > Is it possible to add columns to Collections?
> > > I am looking at a grid on a form.
> > > The grid is bound to a native view.
> > > The field I want to display in the grid isn't listed in the columns collection.
> > >
> > > Thanks
> > >
> >
>