Question Vb in a Command Button

josh2009

Member
Joined
Sep 16, 2009
Messages
14
Programming Experience
Beginner
I have a VB Script that I am working on for a purchased application. I added a command button that hopefully would insert a NEW record into a table named Interventional_Devices. Data will be coming from three tables called Lesions, InvSupplyItems & Cath_equipment. Pls note that I commented out any reference to one of the tables called InvSupplyItems to simplify things. I have written another script that is very similar to this and I am able to transfer data from a control from one SQL table to another control that uses a different SQL table. But that is using the current data of an existing record and copy it to another existing record of a different table. The difference with this one is the successful script was just with 2 tables involved (current records being updated) while this one has 3 tables and trying to insert a NEW record in Interventional_Devices.

I have a VB script called BLGHScriptInterventionalDevices.lvb that is attached to the command button control's Command Property as Script(BLGHScriptInterventionalDevices. InterventionalDevices). Here is the code -



References System.dll
References Lumedx.Application.dll
References Lumedx.Core.dll

Imports System
Imports Microsoft.VisualBasic
Imports Lumedx.ActiveData
Imports Lumedx.Application
'Imports Lumedx.Cath
Imports System.Collections
'Imports System.Data
Imports System.Math

Public Class BLGHScriptInterventionalDevices

Dim bFlag as Boolean=False

'-------------------------------------------------------------------------------
' Script: InterventionalDevices (InterventionalDevices.lvb)
'
'
' Notes: populate Interventional Devices from Cath Equipment
'
'
' Public Variables
' None
'
' Dependencies
' Lumedx.Common.Utilities
'
' Jovy Banaag BryanLGH Medical Center
'
' History
' 09/24/09 Created
'-------------------------------------------------------------------------------

'Public Sub InterventionalDevices (ByVal t As Trigger)
Sub InterventionalDevices ()

Dim currentCathRecord As Record
Dim currentLesionRecord As Record
'Dim currentInvRecord As Record
Dim currentDevicesRecord As New Record

If bFlag THEN
Return
Else
bFlag=True
End If


currentCathRecord =
Lumedx.Application.WorkflowContext.Current.ActiveDataSet.Tables("Cath_Equipment").CurrentRecord

currentLesionRecord = Lumedx.Application.WorkflowContext.Current.ActiveDataSet.Tables("Lesions").CurrentRecord

'currentInvRecord =
'Lumedx.Application.WorkflowContext.Current.ActiveDataSet.Tables("InvSupplyItems").CurrentRecord

currentDevicesRecord =
Lumedx.Application.WorkflowContext.New.ActiveDataSet.Tables("Interventional_Devices").NewRecord

If currentCathRecord is Nothing Then
bFlag=false
msgbox("Cath record is blank")
return
End if

If currentLesionRecord is Nothing Then
bFlag=false
msgbox("Lesion record is blank")
return
End if

'If currentInvRecord is Nothing Then
'bFlag=false
'msgbox("Supply record is blank")
'return
'End if

If currentLesionRecord("SS_Event_Cath_ID") = currentCathRecord("SS_Event_Cath_ID") And

currentLesionRecord("VesselSegment") = currentCathRecord("VesselSegment") THEN

'currentDevicesRecord("SS_Lesion_ID") = currentLesionRecord("SS_Lesion_ID")
msgbox("Test Lesion record is being inserted...")
currentCathRecord("Serial_Number") = currentLesionRecord("VesselSegment")
currentDevicesRecord("Device_Name") = currentCathRecord("Item")
currentDevicesRecord("Device_Size") = " "
currentDevicesRecord("Pre_Stenosis") = currentLesionRecord("Pre_Stenosis")
currentDevicesRecord("Post_Stenosis") = currentLesionRecord("Post_Stenosis")
'currentDevicesRecord("Comment") = " "
'currentDevicesRecord("Device_Type") = currentInvRecord("bDeviceType")
'currentDevicesRecord("Sequence") = " "
'currentDevicesRecord("DeviceSequence") = " "
'currentDevicesRecord("CanBePrimary") = " "
'currentDevicesRecord("DeviceManufacturer") = currentInvRecord("Manufacturer")
'currentDevicesRecord("DiamRequired") = " "
'currentDevicesRecord("DeviceDiameter") = currentInvRecord("bDeviceDiameter")
'currentDevicesRecord("LenRequired") = " "
'currentDevicesRecord("DeviceLength") = currentInvRecord("bDeviceLength")
'currentDevicesRecord("DeviceBarcode") = currentInvRecord("BarCode")
'currentDevicesRecord("ACCICDeviceID") = currentInvRecord("bACCICDeviceID")
'currentDevicesRecord("ACCDeviceName") = currentInvRecord("bACCDeviceName")
'currentDevicesRecord("SSVascularData") = " "
'currentDevicesRecord("MinPressure") = 0
'currentDevicesRecord("MaxPressure") = 0
'currentDevicesRecord("Serial_Number") = " "
'currentDevicesRecord("Inflations") = 0
'currentDevicesRecord("NewSequence") = 0
'currentDevicesRecord("ACCExistingDeviceID") = 0
'currentDevicesRecord("DimensionsRequired") = " "
'currentDevicesRecord("SSDeviceCounter") = " "

End If

bFlag=False

End Sub

End Class

Pls note that I added New in the definition of the currentDevicesRecord and changed the CurrentRecord to NewRecord since I am trying to insert a new record for Interventional_Devices. When I click on the button, this is the error I get -

Compilation error: C:\Documents and Settings\vjb001\Local Settings\Temp\myymmmsd.0.vb(39,0) : error BC30652: Reference required to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' containing the type 'System.Data.DataRow'. Add one to your project.
C:\Documents and Settings\vjb001\Local Settings\Temp\myymmmsd.0.vb(51,0) : error BC30282: Constructor call is valid only as the first statement in an instance constructor.

System.ApplicationException: Compilation error: C:\Documents and Settings\vjb001\Local Settings\Temp\myymmmsd.0.vb(39,0) : error BC30652: Reference required to assembly 'System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' containing the type 'System.Data.DataRow'. Add one to your project.
C:\Documents and Settings\vjb001\Local Settings\Temp\myymmmsd.0.vb(51,0) : error BC30282: Constructor call is valid only as the first statement in an instance constructor.

at Lumedx.Core.Reflection.AssemblyInfo.Build()
at Lumedx.Core.Reflection.AssemblyBuilder.GetAssemblyInfo(String sourceFile, String outputAssembly, CodeDomProvider provider)
at Lumedx.Core.Reflection.AssemblyBuilder.InnerGetAssembly(String sourceFile, String outputAssembly, CodeDomProvider provider)
at Lumedx.Core.Reflection.AssemblyBuilder.GetAssembly(String sourceFile)
at Lumedx.Core.Reflection.Extern..ctor(String sourceFile)
at Lumedx.SystemData.Script.GetExtern()
at Lumedx.SystemData.Script.InnerInvoke(Object[] args)
at Lumedx.SystemData.Script.Invoke(Object[] args)
at Lumedx.CardioDoc.WorkflowManager.mWorkflowContext_ScriptRequested(Object sender, ScriptRequestedEventArgs e)

Any help will be greatly appreciated since I am new with VB.net programming. Thanks
 
Back
Top