Count Records In Combo Box - Vantage 8

Hi.  I want to create a form customisation for Kanban Entry that after the part number has been entered counts the number of records available in the Part Revision combo box.  The reason for this is so we can pop up a message box if there are more than approved revisions... anyone point me in the right direction for counting these records?

 

I have tried doing this via a BPM but informational messges don't work on KanbanReceipts.ChangePart in our version and have been advised by Epicor that for customisation is the only way :(  Thanks.

The comboBox.Items.Count property should give you the number of items in a combbox.

Rough outline of events needed, syntax may be off

Use GetNativeControlReference to get a reference to the revision control.

EpiCombo mycombo = (EpiCombo)GetNativeControlReference("GUID-of-Combo");

Use wizard to trap change of value in Partnumber field (column change)

MessageBox.Show(myCombo.Items.Count.ToString()); // or other appropriate method of informing user.

Jim Kinneman
Encompass Solutions, Inc.

Thank you... I have the following code but it is giving the error posted at the end of this post.  I have tried changing Items to Rows and the message posts but not with the correct information.  Can you see where I am going wrong?

 

 

Private Sub KanbanReceipts_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles KanbanReceipts_Column.ColumnChanged
  '// ** Argument Properties and Uses **
  '// args.Row("[FieldName]")
  '// args.Column, args.ProposedValue, args.Row
  '
  'Add Event Handler Code
  '
  Select Case args.Column.ColumnName
 
   Case "Quantity"
           
                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim countRev = cboRev.Items.Count
               
                MessageBox.Show(countRev)
               
   Case Else
 
  End Select
 
 End Sub

 

Public member 'Items' on type 'PartRevisionCombo' not found.

 

Stack Trace

===========

at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)

at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)

at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)

at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)

at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at System.Data.DataRow.set_Item(DataColumn column, Object value)

at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)

at System.Data.DataRowView.set_Item(String property, Object value)

at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)

 



--- In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

The comboBox.Items.Count property should give you the number of items in a combbox.

Rough outline of events needed, syntax may be off

Use GetNativeControlReference to get a reference to the revision control.

EpiCombo mycombo = (EpiCombo)GetNativeControlReference("GUID-of-Combo");

Use wizard to trap change of value in Partnumber field (column change)

MessageBox.Show(myCombo.Items.Count.ToString()); // or other appropriate method of informing user.

Jim Kinneman
Encompass Solutions, Inc.
this may work...

Dim cmb As Epicor.Mfg.UI.FrameWork.EpiUltraCombo
Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
Dim count as Integer
count =0
For i as integer = 0 To (cmb.Rows.Count) - 1
   count =count +1
 Next
msgbox(count.ToString())


From: "tracy.smith@..." <tracy.smith@...>
To: vantage@yahoogroups.com
Sent: Thursday, September 12, 2013 12:09 PM
Subject: [Vantage] RE: Re: Count Records In Combo Box - Vantage 8

 
<div id="ygrps-yiv-1731734741yiv5970129987ygrp-text">
  
  
  <div>Thank you... I have the following code but it is giving the error posted at the end of this post.&nbsp; I have tried changing Items to Rows and the message posts but not with the correct information.&nbsp; Can you see where I am going wrong?</div><div><var id="ygrps-yiv-1731734741yiv5970129987yui-ie-cursor"></var>&nbsp;</div><div>&nbsp;</div><div>Private Sub KanbanReceipts_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles KanbanReceipts_Column.ColumnChanged<br>&nbsp;&nbsp;&#39;// ** Argument Properties and Uses **<br>&nbsp;&nbsp;&#39;// args.Row(&quot;[FieldName]&quot;)<br>&nbsp;&nbsp;&#39;// args.Column, args.ProposedValue, args.Row<br>&nbsp;&nbsp;&#39;<br>&nbsp;&nbsp;&#39;Add Event Handler Code<br>&nbsp;&nbsp;&#39;<br>&nbsp;&nbsp;Select Case args.Column.ColumnName<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;Case &quot;Quantity&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim countRev = cboRev.Items.Count
               
                MessageBox.Show(countRev)
               
   Case Else
 
  End Select
 
 End Sub

 
Public member 'Items' on type 'PartRevisionCombo' not found.

 
Stack Trace
===========
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)
at System.Data.DataRowView.set_Item(String property, Object value)
at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)
 


--- In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

The comboBox.Items.Count property should give you the number of items in a combbox.

Rough outline of events needed, syntax may be off

Use GetNativeControlReference to get a reference to the revision control.

EpiCombo mycombo = (EpiCombo)GetNativeControlReference("GUID-of-Combo");

Use wizard to trap change of value in Partnumber field (column change)

MessageBox.Show(myCombo.Items.Count.ToString()); // or other appropriate method of informing user.

Jim Kinneman
Encompass Solutions, Inc.
</div>


instead of Items.Count use Rows.Count


dim x as integer = (cmb.Rows.Count) - 1


:)



--- In vantage@yahoogroups.com, <jyprksh@...> wrote:

this may work...

Dim cmb As Epicor.Mfg.UI.FrameWork.EpiUltraCombo
Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
Dim count as Integer
count =0
For i as integer = 0 To (cmb.Rows.Count) - 1
   count =count +1
 Next
msgbox(count.ToString())


From: "tracy.smith@..." <tracy.smith@...>
To: vantage@yahoogroups.com
Sent: Thursday, September 12, 2013 12:09 PM
Subject: [Vantage] RE: Re: Count Records In Combo Box - Vantage 8

 
<div id="ygrps-yiv-1077216319yiv5970129987ygrp-text">
  
  
  <div>Thank you... I have the following code but it is giving the error posted at the end of this post.&nbsp; I have tried changing Items to Rows and the message posts but not with the correct information.&nbsp; Can you see where I am going wrong?</div><div><var id="ygrps-yiv-1077216319yiv5970129987yui-ie-cursor"></var>&nbsp;</div><div>&nbsp;</div><div>Private Sub KanbanReceipts_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles KanbanReceipts_Column.ColumnChanged<br>&nbsp;&nbsp;&#39;// ** Argument Properties and Uses **<br>&nbsp;&nbsp;&#39;// args.Row(&quot;[FieldName]&quot;)<br>&nbsp;&nbsp;&#39;// args.Column, args.ProposedValue, args.Row<br>&nbsp;&nbsp;&#39;<br>&nbsp;&nbsp;&#39;Add Event Handler Code<br>&nbsp;&nbsp;&#39;<br>&nbsp;&nbsp;Select Case args.Column.ColumnName<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;Case &quot;Quantity&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim countRev = cboRev.Items.Count
               
                MessageBox.Show(countRev)
               
   Case Else
 
  End Select
 
 End Sub

 
Public member 'Items' on type 'PartRevisionCombo' not found.

 
Stack Trace
===========
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)
at System.Data.DataRowView.set_Item(String property, Object value)
at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)
 


--- In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

The comboBox.Items.Count property should give you the number of items in a combbox.

Rough outline of events needed, syntax may be off

Use GetNativeControlReference to get a reference to the revision control.

EpiCombo mycombo = (EpiCombo)GetNativeControlReference("GUID-of-Combo");

Use wizard to trap change of value in Partnumber field (column change)

MessageBox.Show(myCombo.Items.Count.ToString()); // or other appropriate method of informing user.

Jim Kinneman
Encompass Solutions, Inc.
</div>


The code below processes but it doesn't count the combo box rows correctly - I changed it slightly as the example produced the error at the bottom of this post.  Any further help much appreciated as we only need this due to the bug in the BPM :(

 

                 Dim cmb As Epicor.Mfg.UI.Framework.EpiCombo
                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim count As Integer
                count = 0
                For i As Integer = 0 To (cboRev.Rows.Count) - 1
                    count = count + 1
                Next
                MessageBox.Show(cboRev.Rows.Count.ToString())

 

 

Error Detail

============

Object reference not set to an instance of an object.

 

Stack Trace

===========

at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)

at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)

at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at System.Data.DataRow.set_Item(DataColumn column, Object value)

at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)

at System.Data.DataRowView.set_Item(String property, Object value)

at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)

 



--- In vantage@yahoogroups.com, <jyprksh@...> wrote:

instead of Items.Count use Rows.Count


dim x as integer = (cmb.Rows.Count) - 1


:)



--- In vantage@yahoogroups.com, <jyprksh@...> wrote:

this may work...

Dim cmb As Epicor.Mfg.UI.FrameWork.EpiUltraCombo
Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
Dim count as Integer
count =0
For i as integer = 0 To (cmb.Rows.Count) - 1
   count =count +1
 Next
msgbox(count.ToString())

From: "tracy.smith@..." <tracy.smith@...>
To: vantage@yahoogroups.com
Sent: Thursday, September 12, 2013 12:09 PM
Subject: [Vantage] RE: Re: Count Records In Combo Box - Vantage 8

 
<div id="ygrps-yiv-846603224yiv5970129987ygrp-text">
  
  
  <div>Thank you... I have the following code but it is giving the error posted at the end of this post.&nbsp; I have tried changing Items to Rows and the message posts but not with the correct information.&nbsp; Can you see where I am going wrong?</div><div><var id="ygrps-yiv-846603224yiv5970129987yui-ie-cursor"></var>&nbsp;</div><div>&nbsp;</div><div>Private Sub KanbanReceipts_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles KanbanReceipts_Column.ColumnChanged<br>&nbsp;&nbsp;&#39;// ** Argument Properties and Uses **<br>&nbsp;&nbsp;&#39;// args.Row(&quot;[FieldName]&quot;)<br>&nbsp;&nbsp;&#39;// args.Column, args.ProposedValue, args.Row<br>&nbsp;&nbsp;&#39;<br>&nbsp;&nbsp;&#39;Add Event Handler Code<br>&nbsp;&nbsp;&#39;<br>&nbsp;&nbsp;Select Case args.Column.ColumnName<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;Case &quot;Quantity&quot;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;


                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim countRev = cboRev.Items.Count
               
                MessageBox.Show(countRev)
               
   Case Else
 
  End Select
 
 End Sub

 
Public member 'Items' on type 'PartRevisionCombo' not found.

 
Stack Trace
===========
at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)
at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)
at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)
at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)
at System.Data.DataRow.set_Item(DataColumn column, Object value)
at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)
at System.Data.DataRowView.set_Item(String property, Object value)
at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)
 


--- In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

The comboBox.Items.Count property should give you the number of items in a combbox.

Rough outline of events needed, syntax may be off

Use GetNativeControlReference to get a reference to the revision control.

EpiCombo mycombo = (EpiCombo)GetNativeControlReference("GUID-of-Combo");

Use wizard to trap change of value in Partnumber field (column change)

MessageBox.Show(myCombo.Items.Count.ToString()); // or other appropriate method of informing user.

Jim Kinneman
Encompass Solutions, Inc.
</div>


Good Day:

 

            Can you just do a calculated field that is just the number 1; then in the display grid, add up ( or count) that field.

            You can, using the Show-Sum function in the grids, do a count, or average, or……

 

 

Sun is on E9 Verion:  9.05.700C – SQL- Unidata - Enterprise-since 10/15/2012

 

 

                                                                                                                                                Len

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of tracy.smith@...
Sent: Monday, September 16, 2013 7:41 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: Count Records In Combo Box - Vantage 8

 

 

The code below processes but it doesn't count the combo box rows correctly - I changed it slightly as the example produced the error at the bottom of this post.  Any further help much appreciated as we only need this due to the bug in the BPM :(

 

                 Dim cmb As Epicor.Mfg.UI.Framework.EpiCombo
                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim count As Integer
                count = 0
                For i As Integer = 0 To (cboRev.Rows.Count) - 1
                    count = count + 1
                Next
                MessageBox.Show(cboRev.Rows.Count.ToString())

 

 

Error Detail

============

Object reference not set to an instance of an object.

 

Stack Trace

===========

at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)

at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)

at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at System.Data.DataRow.set_Item(DataColumn column, Object value)

at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)

at System.Data.DataRowView.set_Item(String property, Object value)

at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)

 



--- In vantage@yahoogroups.com, <jyprksh@...> wrote:

instead of Items.Count use Rows.Count

 

dim x as integer = (cmb.Rows.Count) - 1

 

:)

 


--- In vantage@yahoogroups.com, <jyprksh@...> wrote:

this may work...

 

Dim cmb As Epicor.Mfg.UI.FrameWork.EpiUltraCombo

Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)

Dim count as Integer

count =0

For i as integer = 0 To (cmb.Rows.Count) - 1

   count =count +1

 Next

msgbox(count.ToString())

 

From: "tracy.smith@..." <tracy.smith@...>
To: vantage@yahoogroups.com
Sent: Thursday, September 12, 2013 12:09 PM
Subject: [Vantage] RE: Re: Count Records In Combo Box - Vantage 8

 

 

Thank you... I have the following code but it is giving the error posted at the end of this post.  I have tried changing Items to Rows and the message posts but not with the correct information.  Can you see where I am going wrong?

 

 

Private Sub KanbanReceipts_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles KanbanReceipts_Column.ColumnChanged
  '// ** Argument Properties and Uses **
  '// args.Row("[FieldName]")
  '// args.Column, args.ProposedValue, args.Row
  '
  'Add Event Handler Code
  '
  Select Case args.Column.ColumnName
 
   Case "Quantity"
           
                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim countRev = cboRev.Items.Count
               
                MessageBox.Show(countRev)
               
   Case Else
 
  End Select
 
 End Sub

 

Public member 'Items' on type 'PartRevisionCombo' not found.

 

Stack Trace

===========

at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)

at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)

at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)

at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)

at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at System.Data.DataRow.set_Item(DataColumn column, Object value)

at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)

at System.Data.DataRowView.set_Item(String property, Object value)

at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)

 

 


--- In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

The comboBox.Items.Count property should give you the number of items in a combbox.

Rough outline of events needed, syntax may be off

Use GetNativeControlReference to get a reference to the revision control.

EpiCombo mycombo = (EpiCombo)GetNativeControlReference("GUID-of-Combo");

Use wizard to trap change of value in Partnumber field (column change)

MessageBox.Show(myCombo.Items.Count.ToString()); // or other appropriate method of informing user.

Jim Kinneman
Encompass Solutions, Inc.

 

This e-mail and any attachments may contain proprietary and/or confidential information. If you are not the intended recipient, please notify the sender immediately by reply e-mail or at 410-472-2900 and then delete the message without using, disseminating, or copying this message or any portion thereof. With e-mail communications you are urged to protect against viruses.

Thank you for your suggestion... If I am understanding you correctly I am unable to use the grid functions as there is no grid on this form.  I am struggling with the correct code to count the rows in the combo box - it either errors or produces incorrect results.  Any help gratefully received. 



--- In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

Good Day:

 

            Can you just do a calculated field that is just the number 1; then in the display grid, add up ( or count) that field.

            You can, using the Show-Sum function in the grids, do a count, or average, or……

 

 

Sun is on E9 Verion:  9.05.700C – SQL- Unidata - Enterprise-since 10/15/2012

 

 

                                                                                                                                                Len

 

From: vantage@yahoogroups.com [mailto:vantage@yahoogroups.com] On Behalf Of tracy.smith@...
Sent: Monday, September 16, 2013 7:41 AM
To: vantage@yahoogroups.com
Subject: [Vantage] RE: Count Records In Combo Box - Vantage 8

 

 

The code below processes but it doesn't count the combo box rows correctly - I changed it slightly as the example produced the error at the bottom of this post.  Any further help much appreciated as we only need this due to the bug in the BPM :(

 

                 Dim cmb As Epicor.Mfg.UI.Framework.EpiCombo
                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim count As Integer
                count = 0
                For i As Integer = 0 To (cboRev.Rows.Count) - 1
                    count = count + 1
                Next
                MessageBox.Show(cboRev.Rows.Count.ToString())

 

 

Error Detail

============

Object reference not set to an instance of an object.

 

Stack Trace

===========

at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)

at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)

at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at System.Data.DataRow.set_Item(DataColumn column, Object value)

at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)

at System.Data.DataRowView.set_Item(String property, Object value)

at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)

 



--- In vantage@yahoogroups.com, <jyprksh@...> wrote:

instead of Items.Count use Rows.Count

 

dim x as integer = (cmb.Rows.Count) - 1

 

:)

 


--- In vantage@yahoogroups.com, <jyprksh@...> wrote:

this may work...

 

Dim cmb As Epicor.Mfg.UI.FrameWork.EpiUltraCombo

Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)

Dim count as Integer

count =0

For i as integer = 0 To (cmb.Rows.Count) - 1

   count =count +1

 Next

msgbox(count.ToString())

 

From: "tracy.smith@..." <tracy.smith@...>
To: vantage@yahoogroups.com
Sent: Thursday, September 12, 2013 12:09 PM
Subject: [Vantage] RE: Re: Count Records In Combo Box - Vantage 8

 

 

Thank you... I have the following code but it is giving the error posted at the end of this post.  I have tried changing Items to Rows and the message posts but not with the correct information.  Can you see where I am going wrong?

 

 

Private Sub KanbanReceipts_AfterFieldChange(ByVal sender As object, ByVal args As DataColumnChangeEventArgs) Handles KanbanReceipts_Column.ColumnChanged
  '// ** Argument Properties and Uses **
  '// args.Row("[FieldName]")
  '// args.Column, args.ProposedValue, args.Row
  '
  'Add Event Handler Code
  '
  Select Case args.Column.ColumnName
 
   Case "Quantity"
           
                Dim cboRev = ctype(csm.GetNativeControlReference("59defd94-45fa-4458-8232-bc193e4b5f89"),EpiCombo)
                Dim countRev = cboRev.Items.Count
               
                MessageBox.Show(countRev)
               
   Case Else
 
  End Select
 
 End Sub

 

Public member 'Items' on type 'PartRevisionCombo' not found.

 

Stack Trace

===========

at Microsoft.VisualBasic.CompilerServices.Symbols.Container.GetMembers(String& MemberName, Boolean ReportErrors)

at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateGet(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack)

at Script.KanbanReceipts_AfterFieldChange(Object sender, DataColumnChangeEventArgs args)

at System.Data.DataColumnChangeEventHandler.Invoke(Object sender, DataColumnChangeEventArgs e)

at System.Data.DataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at Epicor.Mfg.BO.KanbanReceiptsDataSet.KanbanReceiptsDataTable.OnColumnChanged(DataColumnChangeEventArgs e)

at System.Data.DataRow.set_Item(DataColumn column, Object value)

at System.Data.DataRowView.SetColumnValue(DataColumn column, Object value)

at System.Data.DataRowView.set_Item(String property, Object value)

at Epicor.Mfg.UI.FrameWork.EpiNumericEditor.TextValidate(Object sender, CancelEventArgs ea)

 

 


--- In vantage@yahoogroups.com, <vantage@yahoogroups.com> wrote:

The comboBox.Items.Count property should give you the number of items in a combbox.

Rough outline of events needed, syntax may be off

Use GetNativeControlReference to get a reference to the revision control.

EpiCombo mycombo = (EpiCombo)GetNativeControlReference("GUID-of-Combo");

Use wizard to trap change of value in Partnumber field (column change)

MessageBox.Show(myCombo.Items.Count.ToString()); // or other appropriate method of informing user.

Jim Kinneman
Encompass Solutions, Inc.

 

This e-mail and any attachments may contain proprietary and/or confidential information. If you are not the intended recipient, please notify the sender immediately by reply e-mail or at 410-472-2900 and then delete the message without using, disseminating, or copying this message or any portion thereof. With e-mail communications you are urged to protect against viruses.