Documentation

Control Reference

Complete reference for all 27 controls available in WebVB Studio. Each control includes properties, methods, events, and code examples.

Form & Window

🪟

Form

The main application window container. Every WebVB project starts with a Form.

Properties

Property Type Description
Caption String The title displayed in the form's title bar
BackColor Color Background color of the form
Width Integer Width of the form in pixels
Height Integer Height of the form in pixels
StartUpPosition Integer Initial position (0=Manual, 1=CenterOwner, 2=CenterScreen)
WindowState Integer Window state (0=Normal, 1=Minimized, 2=Maximized)

Events

Load Unload Resize Click DblClick KeyPress KeyDown KeyUp

Example

Sub Form1_Load
  Form1.Caption = "My Application"
  Form1.BackColor = "#ffffff"
End Sub

Input Controls

🔘

CommandButton

A clickable button that triggers actions when pressed.

Properties

Property Type Description
Caption String Text displayed on the button
Enabled Boolean Whether the button can be clicked
Visible Boolean Whether the button is visible
BackColor Color Background color
ForeColor Color Text color
FontSize Integer Font size in points

Events

Click MouseEnter MouseLeave

Example

Sub cmdSubmit_Click
  MsgBox "Button clicked!"
  cmdSubmit.Enabled = False
End Sub
📝

TextBox

Single or multi-line text input field.

Properties

Property Type Description
Text String The text content
MultiLine Boolean Enable multi-line input
PasswordChar String Character to mask input (e.g., "*")
MaxLength Integer Maximum character limit
ReadOnly Boolean Prevent user editing
Placeholder String Placeholder text when empty

Events

Change KeyPress KeyDown KeyUp GotFocus LostFocus

Example

Sub txtName_Change
  lblPreview.Caption = "Hello, " & txtName.Text
End Sub
🏷️

Label

Displays static or dynamic text.

Properties

Property Type Description
Caption String The displayed text
Alignment Integer Text alignment (0=Left, 1=Right, 2=Center)
WordWrap Boolean Enable text wrapping
ForeColor Color Text color
FontSize Integer Font size
FontBold Boolean Bold text

Events

Click DblClick

Example

lblStatus.Caption = "Ready"
lblStatus.ForeColor = "#00ff00"
☑️

CheckBox

A toggle control for boolean values.

Properties

Property Type Description
Caption String Label text
Value Integer 0=Unchecked, 1=Checked, 2=Grayed
Enabled Boolean Whether interactive

Events

Click Change

Example

Sub chkAgree_Click
  If chkAgree.Value = 1 Then
    cmdSubmit.Enabled = True
  Else
    cmdSubmit.Enabled = False
  End If
End Sub
🔘

OptionButton

Radio button for mutually exclusive options within a group.

Properties

Property Type Description
Caption String Label text
Value Boolean Selected state
GroupName String Group identifier

Events

Click Change

Example

Sub optSmall_Click
  CalcPrice
End Sub
Sub optMed_Click
  CalcPrice
End Sub
Sub optLarge_Click
  CalcPrice
End Sub

Sub CalcPrice
  If optSmall.Value = 1 Then total = 10
  If optMed.Value = 1 Then total = 14
  If optLarge.Value = 1 Then total = 18
  lblTotal.Caption = "$" & total
End Sub
📋

ComboBox

Dropdown list with optional text entry.

Properties

Property Type Description
Text String Current text/selection
ListIndex Integer Selected item index (-1 if none)
ListCount Integer Number of items (read-only)
Style Integer 0=Dropdown Combo, 1=Simple, 2=Dropdown List

Methods

AddItem(item) RemoveItem(index) Clear()

Events

Click Change

Example

Sub Form1_Load
  cboCrust.Clear
  cboCrust.AddItem "Thin Crust"
  cboCrust.AddItem "Deep Dish"
  cboCrust.AddItem "Stuffed Crust"
  cboCrust.ListIndex = 0
End Sub
📜

ListBox

Scrollable list of selectable items.

Properties

Property Type Description
ListIndex Integer Selected item index
ListCount Integer Total item count
MultiSelect Integer 0=None, 1=Simple, 2=Extended
Selected(index) Boolean Selection state of item

Methods

AddItem(item) RemoveItem(index) Clear() List(index)

Events

Click DblClick Change

Example

Sub cmdAdd_Click
  lstTasks.AddItem txtTask.Text
  txtTask.Text = ""
  lblStatus.Caption = "Task added."
End Sub

Sub cmdRemove_Click
  If lstTasks.ListIndex = -1 Then
    MsgBox "Select an item to remove."
    Exit Sub
  End If
  lstTasks.RemoveItem lstTasks.ListIndex
End Sub

Containers

🔲

Frame

Groups related controls together with an optional caption.

Properties

Property Type Description
Caption String Group title
BorderStyle Integer 0=None, 1=Fixed Single

Events

Click

Example

' Place OptionButtons inside a Frame
' to create a mutually exclusive group

' fraSize contains optSmall, optMed, optLarge
' fraToppings contains chkPep, chkSaus, chkXCheese

Sub optSmall_Click
  CalcPrice
End Sub
📑

TabContainer

Tabbed panel container for organizing content.

Properties

Property Type Description
SelectedTab Integer Currently active tab index
TabCount Integer Number of tabs

Methods

AddTab(title) RemoveTab(index)

Events

TabChange

Example

Sub TabContainer1_TabChange
  lblStatus.Caption = "Tab " & TabContainer1.SelectedTab
End Sub

Data & Tables

📊

Table (Grid)

Display and edit tabular data with MSFlexGrid-compatible API.

Properties

Property Type Description
Rows Integer Number of rows
Cols Integer Number of columns
FixedRows Integer Number of fixed header rows
FixedCols Integer Number of fixed columns
TextMatrix(row, col) String Get/set cell value at row,col

Methods

AddItem(tabSeparatedRow) RemoveItem(index) Clear()

Events

Click DblClick CellChange

Example

Sub Form1_Load
  Grid1.Rows = 1
  Grid1.Cols = 4
  Grid1.FixedRows = 1
  Grid1.FixedCols = 0

  Grid1.TextMatrix(0, 0) = "Date"
  Grid1.TextMatrix(0, 1) = "Region"
  Grid1.TextMatrix(0, 2) = "Rep"
  Grid1.TextMatrix(0, 3) = "Sales"
End Sub

Sub cmdLoad_Click
  Dim row
  row = Replace("2023-10-01,North,Smith,1500", ",", vbTab)
  Grid1.AddItem row
End Sub
🗃️

DataGrid

Advanced data grid with sorting, pagination, and striped rows. Supports Pandas DataFrames in Python mode.

Properties

Property Type Description
columns Array Column definitions array
data Array Row data array
selectedIndex Integer Selected row index (-1 if none)
pageSize Integer Number of rows per page
sortable Boolean Enable column sorting
striped Boolean Alternate row colors
bordered Boolean Show cell borders
compact Boolean Compact row height
showPagination Boolean Show page navigation

Methods

Refresh()

Events

CellClick SelectionChange

Example

# Python with Pandas
import pandas as pd

def cmdLoadData_Click():
    df = pd.DataFrame({
        "Product": ["Laptop", "Mouse", "Keyboard"],
        "Price": [1299.99, 29.99, 89.99],
        "Stock": [25, 150, 60]
    })
    grdProducts.DataFrame = df
📈

Chart

Data visualization with bar, line, and pie chart types.

Properties

Property Type Description
ChartType String "0 - Bar", "1 - Line", "2 - Pie"
Title String Chart title

Methods

AddPoint(label, value, color) Clear()

Events

Click

Example

Sub Form1_Load
  Chart1.Title = "Q1 Sales Performance"
  Chart1.Clear
  Chart1.AddPoint "Jan", 450, vbBlue
  Chart1.AddPoint "Feb", 520, vbGreen
  Chart1.AddPoint "Mar", 380, vbRed
End Sub

Sub optBar_Click
  Chart1.ChartType = "0 - Bar"
End Sub
Sub optLine_Click
  Chart1.ChartType = "1 - Line"
End Sub
Sub optPie_Click
  Chart1.ChartType = "2 - Pie"
End Sub
🗄️

Database

Data persistence with record navigation and CRUD operations.

Properties

Property Type Description
DatabaseName String Name of the database
TableName String Active table name
Editable Boolean Whether records can be edited
RecordCount Integer Number of records (read-only)
RecordIndex Integer Current record position (read-only)
NoMatch Boolean True if FindFirst found no match
Fields(name) Variant Get/set field value by name

Methods

CreateTable(name, schema) DropTable(name) TableExists(name) AddNew() Edit() Update() Delete() Clear() MoveFirst() MoveLast() MoveNext() MovePrevious() FindFirst(criteria) ExportJSON() ImportJSON(json)

Events

RecordChange Error

Example

Sub Form1_Load
  Data1.CreateTable "Products", "ID:AutoNumber, Name:Text, Price:Number"
  Data1.TableName = "Products"

  Data1.AddNew
  Data1.Fields("Name") = "Laptop Pro"
  Data1.Fields("Price") = 1299.99
  Data1.Update

  Data1.MoveFirst
  lblStatus.Caption = "Record 1 of " & Data1.RecordCount
End Sub

Sub cmdFind_Click
  Data1.FindFirst "Name = 'Laptop Pro'"
  If Data1.NoMatch Then
    MsgBox "Not found"
  End If
End Sub

Media & Graphics

🖼️

Image

Display images from URLs or local files.

Properties

Property Type Description
Picture String Image URL or path
Stretch Boolean Stretch to fit
SizeMode String contain, cover, fill, none

Events

Click DblClick Load Error

Example

Image1.Picture = "https://example.com/photo.jpg"
Image1.Stretch = True
🎨

Canvas

HTML5 Canvas for graphics and game development.

Properties

Property Type Description
Width Integer Canvas width
Height Integer Canvas height

Methods

Clear() DrawRect(x, y, w, h, color) FillRect(x, y, w, h, color) DrawCircle(x, y, r, color) FillCircle(x, y, r, color) DrawLine(x1, y1, x2, y2, color) DrawText(text, x, y, color, size) DrawImage(img, x, y) SetPixel(x, y, color) GetPixel(x, y)

Events

Click MouseMove MouseDown MouseUp KeyDown KeyUp

Example

Dim ball_x, ball_y, ball_dx, ball_dy

Sub Form1_Load
  ball_x = 200 : ball_y = 150
  ball_dx = 4  : ball_dy = 3
End Sub

Sub Timer1_Timer
  Canvas1.Clear
  Canvas1.FillCircle ball_x, ball_y, 20, "#ff4444"
  Canvas1.DrawText "Score: " & score, 10, 20, "#ffffff", 14

  ball_x = ball_x + ball_dx
  ball_y = ball_y + ball_dy
  If ball_x < 20 Or ball_x > 430 Then ball_dx = 0 - ball_dx
  If ball_y < 20 Or ball_y > 280 Then ball_dy = 0 - ball_dy
End Sub

Shape

Draw basic geometric shapes.

Properties

Property Type Description
Shape Integer 0=Rectangle, 1=Square, 2=Oval, 3=Circle, 4=Rounded Rectangle
FillColor Color Fill color
BorderColor Color Border color
BorderWidth Integer Border thickness

Events

Click

Example

Shape1.Shape = 3  ' Circle
Shape1.FillColor = "#ff6600"
Shape1.BorderColor = "#000000"
🔋

Gauge

Radial or half-circle gauge for displaying sensor values, percentages, and metrics.

Properties

Property Type Description
Value Number Current gauge value
MinValue Number Minimum scale value
MaxValue Number Maximum scale value
Title String Gauge label
Unit String Unit suffix (e.g. "V", "A", "%")
Decimals Integer Decimal places for displayed value
GaugeStyle String "0 - Radial" or "1 - Half"
ColorLow Color Color for low range
ColorMid Color Color for mid range
ColorHigh Color Color for high range
ThresholdLow Number Low/mid boundary value
ThresholdHigh Number Mid/high boundary value
ShowValue Boolean Display numeric value
ShowMinMax Boolean Display min/max labels

Events

Click

Example

' Battery monitor gauges
Sub Form1_Load
  GaugeVolts.MinValue = 10
  GaugeVolts.MaxValue = 16
  GaugeVolts.Title = "Voltage"
  GaugeVolts.Unit = "V"
  GaugeVolts.ThresholdLow = 11.5
  GaugeVolts.ThresholdHigh = 13.5
  GaugeVolts.GaugeStyle = "0 - Radial"

  GaugeSoc.MinValue = 0
  GaugeSoc.MaxValue = 100
  GaugeSoc.Title = "SOC"
  GaugeSoc.Unit = "%"
End Sub

' Update from MQTT data
Sub UpdateGauges(voltage, soc)
  GaugeVolts.Value = voltage
  GaugeSoc.Value = soc
End Sub

Networking & IoT

🌐

WebBrowser

Embedded web browser control (iframe-based).

Properties

Property Type Description
Url String Current URL
DocumentText String HTML content

Methods

Navigate(url) GoBack() GoForward() Refresh() Stop()

Events

DocumentComplete NavigateError BeforeNavigate

Example

Sub Form1_Load
  Web1.Url = "https://www.wikipedia.org"
  txtUrl.Text = "https://www.wikipedia.org"
End Sub

Sub cmdGo_Click
  Web1.Navigate txtUrl.Text
  lblStatus.Caption = "Navigating..."
End Sub

Sub Web1_DocumentComplete
  lblStatus.Caption = "Done"
End Sub
📡

Inet

HTTP client for API calls, WebSockets, JSON, and file downloads.

Properties

Property Type Description
URL String Request URL
ResponseStatus Integer HTTP status code (read-only)
ResponseType String Response content type (read-only)
Timeout Integer Request timeout in ms
RetryCount Integer Number of retries on failure
CacheEnabled Boolean Enable response caching
CacheDuration Integer Cache TTL in seconds

Methods

OpenURL(url) Execute(url, method, body, headers) GetJSON(url, callback) PostJSON(url, data, callback) SetHeader(name, value) ClearHeaders() QueueRequest(url, method, callback) ExecuteQueue() OpenWebSocket(url) SendWebSocket(data) CloseWebSocket() Download(url, filename)

Events

Complete Error WebSocketMessage WebSocketOpen WebSocketClose

Example

' Simple GET request
Sub cmdFetch_Click
  Dim result
  result = Inet1.OpenURL("https://api.ipify.org")
  MsgBox "Your IP: " & result
End Sub

' JSON with callback
Sub cmdGetJSON_Click
  Inet1.GetJSON "https://jsonplaceholder.typicode.com/users/1", "OnJSON"
End Sub

Sub OnJSON(data)
  txtOutput.Text = "Name: " & data("name")
End Sub

' Authenticated request
Sub cmdAuth_Click
  Dim response
  response = Inet1.Execute(txtUrl.Text, "GET", "", "Authorization: Bearer " & txtToken.Text)
  txtResponse.Text = response
End Sub
📶

MQTT

MQTT client for IoT messaging, real-time data, and Victron Energy integration.

Properties

Property Type Description
BrokerUrl String MQTT broker hostname or WebSocket URL
Port Integer Broker port (8883 for TLS, 9001 for WebSocket)
UseTLS Boolean Enable TLS/SSL encryption
Username String Authentication username
Password String Authentication password
AutoReconnect Boolean Auto-reconnect on disconnect
AutoParseJSON Boolean Automatically parse JSON payloads
MessagesReceived Integer Total messages received (read-only)
MessagesSent Integer Total messages sent (read-only)

Methods

Connect() Disconnect() Subscribe(topic) Unsubscribe(topic) Publish(topic, message) IsConnected()

Events

Connect Disconnect Message Error

Example

Sub cmdConnect_Click
  Mqtt1.BrokerUrl = "mqtt7.victronenergy.com"
  Mqtt1.Port = 8883
  Mqtt1.UseTLS = True
  Mqtt1.Connect
End Sub

Sub Mqtt1_Connect
  Mqtt1.Subscribe "N/+/system/0/Dc/Battery/Voltage"
  Mqtt1.Subscribe "N/+/system/0/Dc/Battery/Soc"
  lblStatus.Caption = "Connected"
End Sub

Sub Mqtt1_Message(topic, payload)
  If InStr(topic, "Voltage") > 0 Then
    GaugeVolts.Value = Val(payload)
  ElseIf InStr(topic, "Soc") > 0 Then
    GaugeSoc.Value = Val(payload)
  End If
End Sub

Sub Mqtt1_Error(errMsg)
  lblStatus.Caption = "Error: " & errMsg
End Sub

Utilities

⏱️

Timer

Triggers events at specified intervals.

Properties

Property Type Description
Interval Integer Interval in milliseconds
Enabled Boolean Whether timer is running

Events

Timer

Example

Sub Form1_Load
  Timer1.Interval = 1000
  Timer1.Enabled = True
  lblTime.Caption = Time

  ' Stopwatch using a second timer
  Timer2.Interval = 100
  Timer2.Enabled = False
End Sub

Sub Timer1_Timer
  lblTime.Caption = Time
End Sub

Sub Timer2_Timer
  TickCount = TickCount + 1
  lblElapsed.Caption = FormatNumber(TickCount / 10, 1) & "s"
  shpProgress.Width = (TickCount * 5) Mod 300
End Sub
📇

Rolodex

Card-based contact browser with alphabetical navigation.

Properties

Property Type Description
CardCount Integer Total number of cards (read-only)
SelectedLetter String Currently active letter tab

Methods

AddCard(name, phone, email, notes, [field, value]...) DeleteCard() GotoLetter(letter) Clear()

Events

CardSelect LetterChange

Example

Sub Form1_Load
  ' Add contacts with custom fields (City, Postal)
  Rolodex1.AddCard "Anderson, David", "555-123-4001", "david@acme.com", "CEO", "City", "New York", "Postal", "10001"
  Rolodex1.AddCard "Baker, Jennifer", "555-123-4002", "jennifer@tech.io", "Developer", "City", "San Francisco", "Postal", "94102"
End Sub

Sub cmdAdd_Click
  Rolodex1.AddCard txtName.Text, txtPhone.Text, txtEmail.Text, txtNotes.Text, "City", txtCity.Text, "Postal", txtPostal.Text
  Dim firstLetter
  firstLetter = UCase(Left(txtName.Text, 1))
  Rolodex1.GotoLetter firstLetter
End Sub
🧩

UserControl

Create custom reusable controls.

Properties

Property Type Description
(Custom) Various Define your own properties

Methods

(Custom methods you define)

Events

(Custom events you define)

Example

' Create a LoginBox UserControl with
' properties: Username, Password
' methods: Clear(), Validate()
' events: LoginClicked, CancelClicked