Skip to content

Open Method

Description

Opens and initializes a newly created data source.

Syntax

Public Function Open() As Boolean

Return Type

True if successful. False otherwise.

Remarks

A DataProvider must first be created using the Create method before it can be opened. This is not necessary if opening an existing data source.

Example

Open Data Source Sample (Visual Basic)

This sample illustrates how to open a DataProvider for the Calendar Control to use to save event data.

Dim ConnectionString As String

'Saves to an XML file in XML format  
ConnectionString = "Provider=XML;Data Source=" & App.Path & "\Events.xml"  

'Saves to a standard file in Binary format  
'ConnectionString = "Data Source=" & App.Path & "\Events.bin"  

'Saves to a Microsoft Access DataBase file  
'ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Events.mdb"  

'Sets the Data Source  
CalendarControl.SetDataProvider ConnectionString  

'If the Data Source cannot be opened, then create a new data source  
If Not CalendarControl.DataProvider.Open Then  
    'Create a new data source to use.  
    CalendarControl.DataProvider.Create  
End If

See Also


Copyright (c) 1998-2024 Codejock Technologies. All rights reserved.