This message contains graphics. If you do not see the graphics: Graphic Version.
 
More On Databases, More Source Code Sample Apps

Checked Out The New Version Yet?

So, have you download the new version of TX Text Control? As I mentioned last week, we have released a new version of TX. Shipped with the Professional Version is now the TX Text Control Class Library, which enables software developers to use TX Text Control with Microsoft Visual C++ and the Microsoft Foundation Classes (MFC). If you missed the article from last week, you can see it again in the TX Text Control Newsletter Archive.

We have created a brand new fully-featured evaluation version.

Also there, you will find a brand new Getting Started Guide. Just this morning was the new version copied onto the server. Go and have a look at it. Just click on the menu point "TX Text Control Getting Started [180 KB]" under the "Documentation" sub heading to download the PDF document. The new version covers the ActiveX and Class Library.

More Sample Applications With Complete Source Code

The source code library was updated yesterday. If you are new to TX Text Control and are looking for some code to get you going, then do NOT miss out on this.

Armed with the new "Getting Started Guide" from above and these sample applications with complete source code, you will get into TX Text Control in no time at all.

Top TX Tip: Getting Data From A Database Into A Report

Text Control's ability to display tables and access the individual table cells from code make it an ideal tool for creating database reports. Its' decimal and right-aligned tabs, as well as proper alignment of negative numbers indicated by brackets, allow for clean and readable formatting of large columns of numbers. Besides these essential features, TX Text Control lets you enhance your report with images, and OLE objects, and all its various formatting options.

This sample program shows you how to create and format a report from a database, and add table captions that are repeated at the top of every page.

The program consists of a simple form that contains a Text Control and a menu. In the File menu, an Access database can be selected, for instance the "nwind.mdb" database that is shipped with VB. The database is opened and displayed in a Text Control table. Once loaded, the report can be printed using the File/Print menu item.

Connecting to the database

There are several ways to get the data from a record to a table cell. In this example we open the database using DAO code, and transfer the data using Text Control's TableCellText property. This approach is easily portable to SQL or other types of database connections.

TableRow = 1 While Not rs.EOF For n = 0 To rs.Fields.Count - 1 If Not IsNull(rs(n)) Then TXTextControl1.TableCellText(MAINTABLEID, TableRow, _ n + 1) = rs(n) End If Next n rs.MoveNext TableRow = TableRow + 1 Wend

If the database contains formatted text, say HTML or RTF data, the TableCellStart property and LoadFromMemory method can be used instead of the TableCellText property.

Creating repeated table headers

Text Control's tables do not have the built-in ability to automatically repeat a table header on every page, but we can create these with page headers:

TXTextControl1.HeaderFooter = txHeader TXTextControl1.HeaderFooterActivate txHeader TXTextControl1.TableInsert 1, rs.Fields.Count, 0, HEADERTABLEID For n = 0 To rs.Fields.Count - 1 TXTextControl1.TableCellText(HEADERTABLEID, 1, n + 1) = _ rs.Fields(n).Name Next n

In brief, that is how it works. The complete sample program also lets you send the report to a printer and select a table and range of records before loading the database.

VB Site Of The Week: VB-2-THE-MAX

Have you visited VB-2-THE-MAX - the online knowledge repository for VB developers http://www.vb2themax.com?

VB-2-The-Max contains over 600 tips, code routines and bug reports, original VB add-ins and controls, a searchable index of 2,000+ Microsoft Knowledge Base articles, original articles, free chapters from VB books, and more. All the additions to the site are edited, so you get a similar coding style and routines with no overlapping features. The site is run by VBPJ and MSPress author Francesco Balena, and is updated weekly. You can also subscribe to the News-2-The-Max newsletter to receive a new VB tip or routine each week, news about latest additions to the web site, and other information that can be useful to VB developers.


Best regards

The Newsletter Team

Text Control GmbH respects your online time and privacy. We only send this newsletter to TX Text Control customers and people who have signed up to receive it. However, if you would prefer not to receive future issues of the newsletter, you may unsubscribe at any time. If you received this newsletter forwarded from a colleague or friend, you may wish to subscribe directly.

Sent to: N/A.

Imprint | Unsubscribe | Subscribe

© 2000 Text Control GmbH. All Rights Reserved.