+1 800 256 3608 (toll-free in North America) or +49 7531 90 60 10| service@combit.com

Newbie help in switching from VB6 to VB.NET w/LL15


(Guest) #1

Have used LL15 and VB6 for years. Would appreciate any help, examples etc. in switching over to use VB.NET 2012 with LL15.

Snippets from VB6 code for printing reports using unbound data.

'This code is used to initiate printing of report
ErrorCode = MainFrm.ListLabel.LlSetPrinterDefaultsDir(ReportPathStr)
ErrorCode = MainFrm.ListLabel.LlSetPrinterToDefault(LL_PROJECT_LIST, ReportPathStr)
ErrorCode = MainFrm.ListLabel.Print(0, LL_PROJECT_LIST, ReportPathStr, 1,_ LL_PRINT_USERSELECT, LL_BOXTYPE_NORMALWAIT, hWnd, “Print Report”, True, Environ$(“temp”))

'LL automatically calls this routine to populate data used by report
Sub ListLabel_CmndDefineFields(ByVal nUserData As Long, ByVal bDummy As Long,_ pnProgressInPerc As Long, pbLastRecord As Long)

Static SetPointIndex As Integer

Select Case bDummy
Case 0 'Live Data
Select Case SetPointIndex
Case Is < NumberOfDataPoints
'Populate FDatadbl with data array
ErrorCode = MainFrm.ListLabel.LlDefineFieldExt(“Field Name1”, FDatadbl(SetPointIndex), LL_NUMERIC)

  If SetPointIndex = NumberOfDataPoints - 1 Then
     pbLastRecord = 1
     SetPointIndex = 0
  Else
     SetPointIndex = SetPointIndex + 1
  End If                             

End Select
Case 1 'Sample data for design time
ErrorCode = MainFrm.ListLabel.LlDefineFieldExt("Field Name1, “1000.1”, LL_NUMERIC)
SetPointIndex = 0
End Select

End Sub


(Guest) #2

Hello Miles,

thank you for your post.

The best way would probably be to move this code to databinding – with .NET, you have several advantages when doing so:

  • support for sortings
  • support for designer preview
  • support for relational data sources and report container

If this isn’t feasible, you should still be able to translate your code to .NET – the component has a DefineFields event (albeit marked as “Obsolete”, however for compatibility reasons we’re unlikely to remove this in the short term), where you can use your code. In principle, replace MainFrm.ListLabel with LL.Core. – you’ll find the “old” API methods underneath this object with only slight signature changes (e.g. LL_NUMERIC would be LlFieldType.Numeric).

Best regards,

Patrick Preuschoff
Technical Support
combit