Passing a value in to a form- revisited..another secnario

R

Robert Johnson

Hi all. This time I just want to pass a interger into my form. It seemed
like a simple thing to do based on the last time when Seth helped me with a
complex one. Well not for me it seems..

My calling code:

Dim frmAFT As New frmBATFMaint(ByVal InvHID As InvHeaderID)

frmAFT.MdiParent = Me.MdiParent

frmAFT.Show()

My Form code:

Imports System.Diagnostics.Debug

Public Class frmBATFMaint

Public locInvHeaderID As Integer

Public Sub New(ByVal InvHID As locInvHeaderID)

InitializeComponent()

Try

Me.BatF_BO1.FillByInventoryItemID(GRS2.frmInventoryMaint.gloInvHeaderID)

'--record exists.. put in edit mode...

Me.Edit()

Catch ex As Exception

'-- no record exists.. so put in add mode...

Me.Add()

Me.BatF_BO1.Item_ID = frmInventoryMaint.gloInvHeaderID

System.Diagnostics.Debug.WriteLine("gloInvHeader: " &
GRS2.frmInventoryMaint.gloInvHeaderID)

End Try

End Sub

Obviously the passed in value is not getting there.. as the debug window is
showing 0 when the passed in value is a 4. So what am I doing wrong?

Regards,

Robert
 
L

Lloyd Sheen

Robert Johnson said:
Hi all. This time I just want to pass a interger into my form. It seemed
like a simple thing to do based on the last time when Seth helped me with
a complex one. Well not for me it seems..

My calling code:

Dim frmAFT As New frmBATFMaint(ByVal InvHID As InvHeaderID)

frmAFT.MdiParent = Me.MdiParent

frmAFT.Show()

My Form code:

Imports System.Diagnostics.Debug

Public Class frmBATFMaint

Public locInvHeaderID As Integer

Public Sub New(ByVal InvHID As locInvHeaderID)

InitializeComponent()

Try


Me.BatF_BO1.FillByInventoryItemID(GRS2.frmInventoryMaint.gloInvHeaderID)

'--record exists.. put in edit mode...

Me.Edit()

Catch ex As Exception

'-- no record exists.. so put in add mode...

Me.Add()

Me.BatF_BO1.Item_ID = frmInventoryMaint.gloInvHeaderID

System.Diagnostics.Debug.WriteLine("gloInvHeader: " &
GRS2.frmInventoryMaint.gloInvHeaderID)

End Try

End Sub

Obviously the passed in value is not getting there.. as the debug window
is showing 0 when the passed in value is a 4. So what am I doing wrong?

Regards,

Robert

Sorry the only thing obvious is that you are not using the value passed into
your constructor.

LS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top