Visual Basic Newsletter #3 - 12-OCT-2001
INDEX
1. A FEW WORDS FROM THE EDITOR
2. VBA: WORD MACRO THAT DISPLAYS THE STRUCTURE OF A DATABASE
3. VB.NET AFTER VISUAL BASIC 6
4. ARTICLES ON THE WEB
########################################################################
1. A FEW WORDS FROM THE EDITOR
In this third issue I'm glad to introduce a VBA example written by
Darshan Pandit.
I'm happy to announce that this newsletter has reached 1000 subscribers
in total. The newsletter can grow in contents and subscribers ONLY
thanks to your collaboration. If you are the author of any material you
consider it's worth publishing, please submit it to us. Links to
interesting material in the web are also most welcome. Please forward
this newsletter to colleagues and friends who might be interested in
this publication, or send them the link:
http://www.latiumsoftware.com/en/visual-basic/index.php
I'd like to invite you to join our Visual Basic forum at Yahoo! Groups
where you can exchange experience with other VB programmers:
VISUAL BASIC PROGRAMMING (FORUM / MAILING LIST)
http://groups.yahoo.com/group/vbasic-en
vbasic-en-subscribe@yahoogroups.com
The forum has quite a few members and almost no messages, but we expect
it'll reach the critical mass one day.
Yours,
Ernesto De Spirito
eds2004 @ latiumsoftware.com
########################################################################
2. VBA: WORD MACRO THAT DISPLAYS THE STRUCTURE OF A DATABASE
Darshan Pandit, one of the members of the vbasic-en forum, and also
subscriber of this newsletter, sent this Word macro that puts the
structures of the tables of an Access database in tables in separate
pages of a Word document.
Word macro "table_info":
------------------------
Option Explicit
Option Compare Text
Sub TABLE_INFO()
Dim DB As DAO.Database
Dim RS As DAO.Recordset
Dim TB As DAO.TableDef
Dim FLD As DAO.Field, FLD2 As DAO.Field
Dim INDX As DAO.Index
Dim RNG As Word.Range
Dim X, Z, CMN
Dim FLDTYPE(1 To 23) As String
On Error GoTo ERRH
FLDTYPE(16) = "Big Integer"
FLDTYPE(9) = "Binary"
FLDTYPE(1) = "Boolean"
FLDTYPE(2) = "Byte"
FLDTYPE(18) = "Char"
FLDTYPE(5) = "Currency"
FLDTYPE(8) = "Date / Time"
FLDTYPE(20) = "Decimal"
FLDTYPE(7) = "Double"
FLDTYPE(21) = "Float"
FLDTYPE(15) = "GUID"
FLDTYPE(3) = "Integer"
FLDTYPE(4) = "Long"
FLDTYPE(11) = "Long Binary (OLE Object)"
FLDTYPE(12) = "Memo"
FLDTYPE(19) = "Numeric"
FLDTYPE(6) = "Single"
FLDTYPE(10) = "Text"
FLDTYPE(22) = "Time"
FLDTYPE(23) = "Time Stamp"
FLDTYPE(17) = "VarBinary"
MsgBox "Please select *.MDB File", vbOKOnly, "Select File..."
Set CMN = New CommonDialog
CMN.DialogTitle = "Open File..."
CMN.InitDir = ActiveDocument.Path
CMN.Filter = "Microsoft Database (*.MDB)|*.mdb|ALL Files (*.*)|(*.*)"
CMN.Flags = cdlOFNHideReadOnly
CMN.MaxFileSize = 1024
CMN.ShowOpen
Set DB = DBEngine.OpenDatabase(CMN.FileName)
ActiveDocument.Content.Delete
X = ""
For Each TB In DB.TableDefs
If TB.Attributes <> 0 Then
Else
X = "Table Name : " & vbTab & TB.Name + vbCrLf + vbCrLf
X = X + "Field Name" + vbTab + "Field Type" + vbTab + "Field Size" _
+ vbCrLf + vbCrLf
Set RNG = ActiveDocument.Paragraphs.Last.Range
Set RS = DB.OpenRecordset(TB.Name, dbOpenDynaset)
For Each FLD In RS.Fields
For Each INDX In TB.Indexes
If INDX.Primary = True Then
For Each FLD2 In INDX.Fields
If FLD2.Name = FLD.Name Then X = X + "[Primary Key] "
Next FLD2
End If
Next INDX
'check whether field is system field used for replication
If InStr(1, FLD.Name, "s_", vbTextCompare) = 0 Then
X = X + FLD.Name + String(15 - Len(FLD.Name), " ") & vbTab & _
FLDTYPE(FLD.Type) & String(25 - Len(FLDTYPE(FLD.Type)), " ") _
& vbTab & FLD.Size & vbCrLf
End If
Next FLD
RNG.Text = X
RNG.ConvertToTable vbTab, , 3
For Each Z In RNG.Tables(RNG.Tables.Count).Columns
Z.Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphCenter
Next Z
RNG.Tables(RNG.Tables.Count).Columns(1).Select
Selection.ParagraphFormat.Alignment = wdAlignParagraphRight
RNG.Collapse
RNG.InsertBreak Type:=wdPageBreak
End If
Next TB
DB.Close
MsgBox "EVERY TABLE INFORMATION HAS BEEN WRITTEN IN SEPARATE TABLE IN" _
& " SEPARATE PAGE", vbInformation, "DONE!"
Exit Sub
ERRH:
MsgBox "ERROR: " & Err.Number & " : " & Err.Description
End Sub
########################################################################
3. VB.NET AFTER VISUAL BASIC 6
There is a lot of excitement about VB.NET among VB programmers, but
behind some new features like true inheritance, free threading and
multi-language compatibility, there will be changes in the way
applications would have to be coded and even designed. Programmers
begin to worry as they start realizing that most existing VB6
applications won't compile without changes in VB.NET (and even if they
do, they might not behave as expected).
VB.NET is not an upgrade from VB6. Although the language may look quite
familiar, indeed it's a new language, and old applications will have to
be ported to compile and work as expected on the new environment.
Here are some articles about the subject, including articles from Bruce
McKinney and Bob Butler, two recognized Visual Basic gurus:
* VB.Net for the VB6 Developer - by Bob Butler, 2001
http://home.earthlink.net/~butlerbob/VBNet/index.htm
* Moving to VB.Net - by Bob Butler, 2001
http://home.earthlink.net/~butlerbob/VBNet/AllPorting.htm
* Developers cry foul over new Microsoft language - by Mary Jo Foley,
2001
http://news.cnet.com/news/0-1003-201-4523043-0.html?tag=st.ne.ron.lthd
* .NET Changes Can't Be Ignored - 2001
http://www.geocities.com/antivisualbasic/cantbeignored.html
* The New Visual Basic - by Mike James, 2000
http://www.vsj.co.uk/archive/dec2000/vb/hovb1-0012.asp
* Get Your Designs in Gear for VB.NET - by Paul R. Reed Jr., 2000
www.vbpj.com/upload/free/features/vbpj/2000/11nov00/pr0011/pr0011.asp
* Visual Basic.NET Revealed - by Bruce McKinney, 2000
http://members.home.net/bruce2u2/vbnet.htm
########################################################################
4. ARTICLES ON THE WEB
* VBA Algorithms: Data Structures - By Rod Stephens
This article explains how to use VBA's fundamental data types to build
a variety of dynamic data structures, including resizable arrays,
linked lists, trees, and sparse arrays. These data structures and
their associated algorithms give a program the flexibility it needs
for advanced data handling.
http://www.microsoft.com/officedev/articles/movs205.htm
* Multithreading in Visual Basic
http://www.microsoft.com/msj/0897/multithreading.htm
http://www.desaware.com/articles/threadingL3.htm
http://www.1perlstreet.com/xq/ASP/txtCodeId.24579/lngWId.1/qx/vb/
scripts/ShowCode.htm
http://www.planet-source-code.com/xq/ASP/txtCodeId.14479/lngWId.1/qx/
vb/scripts/ShowCode.htm
http://gethelp.devx.com/techtips/thevbpro/10_minute_solutions/feb01/
10min0201ma.asp
* Send and Receive E-Mail Messages with Visual Basic
Using MAPI (messaging application program interface) controls to
create mail-enabled Visual Basic applications.
http://visualbasic.about.com/library/weekly/aa051401a.htm
* Advanced SQL Techniques - Part 1: Analyzing Duplicate Records - By
David Penton
Quick and efficient way to delete duplicate records from a table.
http://www.15seconds.com/issue/011009.htm
* Screen Savers - Inside & Out
Windows screen savers are among the most popular downloads on the Web.
Screen savers will extend your monitor's life, but at the same time
they can extend your privacy and entertain you. Learn how to make one
of your own.
http://visualbasic.about.com/library/weekly/aa050701a.htm
* Learning ADSI - Part I: Adding Users To W2K - By Remie Bolte
Introduction to ADSI using code to add users to W2K
http://www.15seconds.com/issue/011005.htm
* Top 5 API Tricks
Introduction to the APIs with five examples
http://visualbasic.about.com/library/weekly/aa040901a.htm
* Creating PGP-Encrypted E-Mails - By Selva Kumar
PGP is an encryption program used for secure transmission of files and
e-mails. This article explains the concepts of PGP, provides details
about installing and configuring the command-line version of PGP, and
explains how an encrypted e-mail can be generated from ASP.
http://www.15seconds.com/issue/011002.htm
* Accessing the Windows Registry with the API - By John Percival
http://vb-world.net/articles/registry2/
* Advanced UI Design Using XML and XSL: Custom Context Menu Creation -
By Joe Slovinski
This article explains how to create a custom, object-specific context
menu of unlimited depth by using XML and XSLT.
http://www.15seconds.com/issue/010927.htm
* Advanced UI Design Using XML and XSL: Folder Tree Creation - By Joe
Slovinski
This article explains how to create a folder tree of unlimited depth by
using XML and XSL, the style-sheet language for XML.
http://www.15seconds.com/issue/010921.htm
* Creating Web Service Client Code Automatically - By Robert Chartier
A wizard that creates Web Service client files for you, based on the
Simple Object Access Protocol (SOAP) Toolkit V2, SP 2.
http://www.15seconds.com/issue/010918.htm
* Charting the Internet - By Mark Mathieson
Step-by-step approach to automatically generate a bar (or pie) chart
from data stored in a database. Then, dynamically hot spots are added
to the bars/slices in the chart to link them to other pages.
http://www.15seconds.com/issue/010914.htm
* Randomizing a Recordset - By Edward Myers
ASP code to shuffle a recordset so that it can be displayed in random
order.
http://www.15seconds.com/issue/010911.htm
* Firing Events in a Shared Hosting Environment - By Matthew Muller
Firing events on a Web server when you don't have your own dedicated
IIS or SQL Server on the Internet.
http://www.15seconds.com/issue/010905.htm
* Create Your Own Visual Basic Add-Ins - By S.S. Ahmed
How to create VB add-ins to add features to the IDE.
http://www.15seconds.com/issue/010828.htm
########################################################################
This newsletter is provided "AS IS" without warranty of any kind. Its
use implies the acceptance of our licensing terms and disclaimer of
warranty you can read at http://www.latiumsoftware.com/en/legal.php
where you will also find a note about legal trademarks. Articles are
copyright of their respective authors and they are reproduced here with
their permission. You can redistribute this newsletter as long as you do
it in full (including copyright notices), without changes and gratis.
------------------------------------------------------------------------
Latium Software http://www.latiumsoftware.com/en/index.php
------------------------------------------------------------------------
Copyright (c) 2001 Ernesto De Spirito. All rights reserved.
------------------------------------------------------------------------
|