Hi all,
i would like to get barcode data (ean-code/serial no.) from the clipboard onto a user form.
this is the coding in vb.net i used to create the form:
Private Sub DisplayScannerForm()
Dim scannerForm As SAPbouiCOM.Form
Dim tmpItem As SAPbouiCOM.Item
scannerForm = SBO_Application.Forms.Add("ScannerForm", SAPbouiCOM.BoFormTypes.ft_Fixed)
scannerForm.Height = 150
scannerForm.Top = SBO_Application.Desktop.Height / 2 - scannerForm.Height
scannerForm.Width = 250
scannerForm.Left = SBO_Application.Desktop.Width / 4 - scannerForm.Width / 2
scannerForm.Visible = True
scannerForm.Title = "Scanner Form"
tmpItem = scannerForm.Items.Add("results", SAPbouiCOM.BoFormItemTypes.it_EDIT)
tmpItem.Height = 120
tmpItem.Top = 1
tmpItem.Width = 220
tmpItem.Left = scannerForm.Width / 2 - tmpItem.Width / 2
tmpItem.Visible = True
...
to get the data from the clipboard onto the form i tried this unsuccessfully(in Private Sub DisplayScannerForm()):
... Dim idata As IDataObject idata = Clipboard.GetDataObject() If idata.GetDataPresent(DataFormats.Text) Then tmpItem.Value = CStr(idata.GetData(DataFormats.Text)) else... end if end sub
when debugging this line by line, after compiling the code and loading the scanner form, it keeps showing that
iData = Nothing. Can anyone tell me why ?
the code for the item event on which the scanner form is loaded looks like this:
Public Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent If pVal.FormType = 25 And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then DisplayScannerForm() End If
Can anyone help me with this ? coding samples would be very helpful.
Thanks very much in advance.
Message was edited by: Daniel Lobotzki