Databases.GetDatabase Method |
Returns a reference to a specified Database object.
Databases.GetDatabase(Index)
Where Index can be either an integer or a string specifying the database name.
Version |
BarTender 7.50 or higher |
Edition |
Automation, Enterprise |
Use the GetDatabase method to access a specific database that is setup in a BarTender document. Index can be either an integer value or a string specifying the database name. The order of databases in the collection is not guaranteed to be in the order appearing in the database setup of the label. Therefore, we recommend that you reference a database by name, rather than by integer index.
'Declare a BarTender application variable
Dim btApp As BarTender.Application
'Declare a BarTender document variable
Dim btFormat As BarTender.Format
'Declare a BarTender database variable
Dim btDb As BarTender.Database
'Create a new instance of BarTender
btApp = New BarTender.Application
'Set the BarTender application visible
btApp.Visible = True
'Open a BarTender document
btFormat = btApp.Formats.Open("c:\Format1.btw", False, "")
'Select the database
btDb = btFormat.Databases.GetDatabase(1)
'Alternatively, use the database's Name property if it is known
'btDb = btFormat.Databases.GetDatabase("bikes")
'Show the database name
MessageBox.Show(btDb.Name)
'End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
// Declare a BarTender application variable
BarTender.Application btApp;
// Declare a BarTender document variable
BarTender.Format btFormat;
// Declare a BarTender database variable
BarTender.Database btDb;
// Create a new instance of BarTender
btApp = new BarTender.Application();
// Set the BarTender application visible
btApp.Visible = true;
// Open a BarTender document
btFormat = btApp.Formats.Open("c:\\Format1.btw", false, "");
// Select the database
btDb = btFormat.Databases.GetDatabase(1);
// Alternatively, use the database's name if it is known
// btDb = btFormat.Databases.GetDatabase("bikes");
// Show the database's name
MessageBox.Show(btDb.Name);
// End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
Related Topics