Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions docs/Reference/Modules/AsyncProperty/AsyncType.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: AsyncType
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/AsyncType
---
# AsyncType
{: .no_toc }

Returns the kind of data being read, as an **AsyncTypeConstants** value. Read-only.

Syntax: *object*.**AsyncType**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

The value mirrors the *AsyncType* argument passed to **UserControl.AsyncRead** when the read was started. It also determines the subtype of [**Value**](Value) once the read completes:

- `vbAsyncTypePicture` (0) — the data is being delivered as an **stdole.IPictureDisp**.
- `vbAsyncTypeFile` (1) — the data is being saved to a temporary file; **Value** holds its path as a **String**.
- `vbAsyncTypeByteArray` (2) — the data is being delivered as a **Byte** array.

### See Also

- [Value](Value) property
- [PropertyName](PropertyName) property
- [Target](Target) property
22 changes: 22 additions & 0 deletions docs/Reference/Modules/AsyncProperty/BytesMax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: BytesMax
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/BytesMax
---
# BytesMax
{: .no_toc }

Returns the total number of bytes expected for the read, as a **Long**. Read-only.

Syntax: *object*.**BytesMax**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

Used together with [**BytesRead**](BytesRead) to drive a progress indicator during an **AsyncReadProgress** event. **BytesMax** can be zero when the server has not advertised a content length — for example with an HTTP chunked transfer — in which case the total size is not known until the read completes and a determinate progress bar cannot be shown.

### See Also

- [BytesRead](BytesRead) property
- [Status](Status) property
- [StatusCode](StatusCode) property
22 changes: 22 additions & 0 deletions docs/Reference/Modules/AsyncProperty/BytesRead.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: BytesRead
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/BytesRead
---
# BytesRead
{: .no_toc }

Returns the number of bytes that have been read so far, as a **Long**. Read-only.

Syntax: *object*.**BytesRead**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

The value accumulates across successive **AsyncReadProgress** notifications and reaches its final total by the time **AsyncReadComplete** fires. When [**BytesMax**](BytesMax) is non-zero, the ratio `BytesRead / BytesMax` gives the fraction of the read that has completed.

### See Also

- [BytesMax](BytesMax) property
- [Status](Status) property
- [StatusCode](StatusCode) property
22 changes: 22 additions & 0 deletions docs/Reference/Modules/AsyncProperty/PropertyName.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: PropertyName
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/PropertyName
---
# PropertyName
{: .no_toc }

Returns the name of the property the read is being performed for, as a **String**. Read-only.

Syntax: *object*.**PropertyName**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

The value is the *PropertyName* argument that was passed to **UserControl.AsyncRead** when the read was started. A user control can have several reads in flight at once, so an event handler typically uses **PropertyName** in a **Select Case** to decide what to do with [**Value**](Value) when the read completes — for example, which property of the control to assign the result to.

### See Also

- [Target](Target) property
- [Value](Value) property
- [AsyncType](AsyncType) property
22 changes: 22 additions & 0 deletions docs/Reference/Modules/AsyncProperty/Status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Status
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/Status
---
# Status
{: .no_toc }

Returns a human-readable description of the current state of the read, as a **String**. Read-only.

Syntax: *object*.**Status**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

The value is a short message such as `"Finding resource"`, `"Connecting"`, or `"Receiving response"`, suitable for display in a status bar or tooltip while the read is in progress. For programmatic logic, examine [**StatusCode**](StatusCode) instead — its values are stable, whereas **Status** is intended for human consumption and may be localised.

### See Also

- [StatusCode](StatusCode) property
- [BytesRead](BytesRead) property
- [BytesMax](BytesMax) property
22 changes: 22 additions & 0 deletions docs/Reference/Modules/AsyncProperty/StatusCode.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: StatusCode
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/StatusCode
---
# StatusCode
{: .no_toc }

Returns the current state of the read, as an **AsyncStatusCodeConstants** value. Read-only.

Syntax: *object*.**StatusCode**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

The value identifies the step the read is currently on — `vbAsyncStatusCodeFindingResource`, `vbAsyncStatusCodeConnecting`, `vbAsyncStatusCodeBeginDownloadData`, `vbAsyncStatusCodeEndDownloadData`, and so on. `vbAsyncStatusCodeError` (0) indicates that the read failed; the [**Status**](Status) property carries the matching human-readable description.

### See Also

- [Status](Status) property
- [BytesRead](BytesRead) property
- [BytesMax](BytesMax) property
22 changes: 22 additions & 0 deletions docs/Reference/Modules/AsyncProperty/Target.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
title: Target
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/Target
---
# Target
{: .no_toc }

Returns the URL or file path being read, as a **String**. Read-only.

Syntax: *object*.**Target**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

The value is the *Target* argument that was passed to **UserControl.AsyncRead** when the read was started — typically an absolute or relative URL, but local file paths are also accepted. It is the location the data is being fetched from, and remains the same across every **AsyncReadProgress** notification and the final **AsyncReadComplete** event for that read.

### See Also

- [PropertyName](PropertyName) property
- [Value](Value) property
- [AsyncType](AsyncType) property
26 changes: 26 additions & 0 deletions docs/Reference/Modules/AsyncProperty/Value.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
title: Value
parent: AsyncProperty Module
permalink: /tB/Packages/VBRUN/AsyncProperty/Value
---
# Value
{: .no_toc }

Returns the result of the asynchronous read, as a **Variant**. Read-only.

Syntax: *object*.**Value**

*object*
: *required* An object expression that evaluates to an **AsyncProperty** object.

**Value** is only meaningful in the **AsyncReadComplete** event — during a progress notification the read has not yet finished. The concrete subtype of **Value** is determined by [**AsyncType**](AsyncType):

- `vbAsyncTypePicture` — an **stdole.IPictureDisp**, which can be assigned to a **Picture** property.
- `vbAsyncTypeFile` — a **String** holding the path of a temporary file containing the downloaded data.
- `vbAsyncTypeByteArray` — a **Byte** array (`Byte()`) holding the raw bytes.

### See Also

- [AsyncType](AsyncType) property
- [PropertyName](PropertyName) property
- [Target](Target) property
46 changes: 46 additions & 0 deletions docs/Reference/Modules/AsyncProperty/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
title: AsyncProperty Module
parent: VBRUN Modules
permalink: /tB/Packages/VBRUN/AsyncProperty/
redirect_from:
- /tB/Modules/AsyncProperty
has_toc: false
---

# AsyncProperty module

The **AsyncProperty** object carries the results of an asynchronous read started with **UserControl.AsyncRead**. It is passed to the **AsyncReadComplete** and **AsyncReadProgress** events, where it identifies which read this notification refers to, reports how far the download has got, and — once complete — supplies the downloaded value. Every property is read-only: the runtime fills the object in before raising the event.

## Identifying the read

A user control may have several outstanding asynchronous reads at once, so the **AsyncProperty** passed to each event has to identify the one the event is for. [**PropertyName**](PropertyName) returns the name supplied to **AsyncRead** when the request was started — typically the name of the property the control is going to assign the value to. [**Target**](Target) returns the URL or file path that was being downloaded. [**AsyncType**](AsyncType) returns an **AsyncTypeConstants** value identifying how the data is being delivered — as a picture, a file, or a byte array.

```tb
Private Sub UserControl_AsyncReadComplete(ByVal Prop As AsyncProperty)
Select Case Prop.PropertyName
Case "Picture"
Set Picture = Prop.Value
Case "DataFile"
' Prop.Value is the path to the downloaded temporary file.
End Select
End Sub
```

## The downloaded value

Once the read finishes, [**Value**](Value) holds the result. Its concrete subtype is determined by **AsyncType**: an **stdole.IPictureDisp** when the data was requested as a picture, a **String** containing the path of a downloaded temporary file when it was requested as a file, or a **Byte** array when the raw bytes were requested. **Value** is only meaningful in the **AsyncReadComplete** event — during a progress notification the read has not yet finished.

## Tracking progress

While a read is in flight, the runtime raises **AsyncReadProgress** periodically so the control can update a progress indicator. [**BytesRead**](BytesRead) reports how many bytes have arrived so far, and [**BytesMax**](BytesMax) the total number expected — though **BytesMax** may be zero when the server has not advertised a content length. [**Status**](Status) returns a human-readable description of the current step ("Connecting", "Receiving response", and so on), and [**StatusCode**](StatusCode) returns the corresponding **AsyncStatusCodeConstants** value for programmatic inspection.

## Members

- [AsyncType](AsyncType) -- returns the kind of data being read (picture, file, or byte array)
- [BytesMax](BytesMax) -- returns the total number of bytes expected for the read
- [BytesRead](BytesRead) -- returns the number of bytes that have been read so far
- [PropertyName](PropertyName) -- returns the name of the property the read is being performed for
- [Status](Status) -- returns a human-readable description of the current read state
- [StatusCode](StatusCode) -- returns the **AsyncStatusCodeConstants** value for the current read state
- [Target](Target) -- returns the URL or path being read
- [Value](Value) -- returns the downloaded value once the read has completed
69 changes: 69 additions & 0 deletions docs/Reference/Modules/ContainedControls/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
---
title: ContainedControls Module
parent: VBRUN Modules
permalink: /tB/Packages/VBRUN/ContainedControls/
redirect_from:
- /tB/Modules/ContainedControls
has_toc: false
---

# ContainedControls module

The **ContainedControls** object is a collection that exposes the controls placed inside an instance of a **UserControl** that has been set up as a control container. The author of the **UserControl** uses this collection to enumerate or inspect those constituent controls at run time. The author of the **UserControl** sees only what the consumer added — controls placed on the **UserControl** at design time by the author themselves are not part of this collection.

The collection is read-only: items cannot be added or removed through it, and the indexer returns existing controls only. To use it, the **UserControl**'s **ControlContainer** property must have been set to **True** at design time.

```tb
' Inside the UserControl that hosts other controls.
Private Sub UserControl_Resize()
Dim ctl As Object
For Each ctl In UserControl.ContainedControls
' Lay each consumer-placed control out within the UserControl.
Next ctl
End Sub
```

## Members

### Count

Returns the number of controls in the collection.

Syntax: *object*.**Count**

*object*
: *required* An object expression that evaluates to a **ContainedControls** object.

The value is a **Long**. Valid indexes for [**Item**](#item) run from `1` to **Count**.

### Item

Returns a single control from the collection by its one-based position.

Syntax: *object*.**Item(** *index* **)**

*object*
: *required* An object expression that evaluates to a **ContainedControls** object.

*index*
: *required* A **Long** giving the one-based position of the control to return. Must be between `1` and [**Count**](#count); otherwise an error occurs.

**Item** is the default member of **ContainedControls**, so the following lines are equivalent:

```tb
Set ctl = UserControl.ContainedControls.Item(1)
Set ctl = UserControl.ContainedControls(1)
```

The result is typed as **Object** because the consumer may have placed any kind of control inside the **UserControl**. Use [**TypeName**](../../../Modules/Information/TypeName) or **TypeOf** to discover the concrete type before binding to a specific control's properties.

### For Each iteration

A **ContainedControls** object can be iterated with the [**For Each...Next**](../../../Core/For-Each-Next) statement, which yields each control in turn, in the order the consumer added them. The hidden `_NewEnum` member supplies the enumerator and is not called directly from user code.

```tb
Dim ctl As Object
For Each ctl In UserControl.ContainedControls
Debug.Print TypeName(ctl)
Next ctl
```
Loading