Retrieving a Record

The TextControl.Load method is used to display RTF formatted text in Text Control 1. As Text Control 2 just displays the RTF source code without any formatting, we can simply use the Text property to load it.

[C#]
private void GetRecord()
{
	string sRTFData = dsRTFData.Tables[0].Rows[iCurrentRow].ItemArray[0].ToString();

	textControl1.Load(sRTFData, TXTextControl.StringStreamType.RichTextFormat);
	SetButtonState();
}
[Visual Basic]
Private Sub GetRecord()
	Dim sRTFData As String = dsRTFData.Tables(0).Rows(iCurrentRow).ItemArray(0).ToString()

	textControl1.Load(sRTFData, TXTextControl.StringStreamType.RichTextFormat)
	SetButtonState()
End Sub

The text format used in this example is RTF, which has the advantage of being accessible by most word processing programs. If this is not an issue, Text Control's binary format may be a better choice, as it is more compact and will take up less space in a database.

<< Previous