Table of Contents

Class UriTextBox

Namespace
NanoByte.Common.Controls
Assembly
NanoByte.Common.WinForms.dll

A HintTextBox designed specifically for entering URIs.

public class UriTextBox : HintTextBox
Inheritance
UriTextBox
Inherited Members
Extension Methods

Remarks

Will turn red for invalid input and green for valid input. Will not allow focus to be lost for invalid input.

Constructors

UriTextBox()

public UriTextBox()

Properties

AllowRelative

When set to true relative URIs are accepted.

public bool AllowRelative { get; set; }

Property Value

bool

HttpOnly

When set to true only URIs starting with "http:" or "https:" will be considered valid.

public bool HttpOnly { get; set; }

Property Value

bool

IsValid

Indicates whether the currently entered text is a valid URI.

public bool IsValid { get; }

Property Value

bool

Uri

The Uri represented by this text box.

[Browsable(false)]
public Uri? Uri { get; set; }

Property Value

Uri

Remarks

It is always safe to set this property. It is safe to read this property after validation has been performed.

Exceptions

UriFormatException

Trying to read while Text is not a well-formed Uri.

Methods

OnDragDrop(DragEventArgs)

Raises the DragDrop event.

protected override void OnDragDrop(DragEventArgs drgevent)

Parameters

drgevent DragEventArgs

A DragEventArgs that contains the event data.

OnDragEnter(DragEventArgs)

Raises the DragEnter event.

protected override void OnDragEnter(DragEventArgs drgevent)

Parameters

drgevent DragEventArgs

A DragEventArgs that contains the event data.

ValidateUri(string)

Checks if a text represents a valid Uri.

protected virtual bool ValidateUri(string text)

Parameters

text string

Text to check.

Returns

bool