Saving a Record

Windows Presentation Foundation User's Guide > Howto: Connect to Databases

All data access is handled by two methods, which are Load and Save. The Save method stores formatted text to a string, which is then passed on to the database engine using Visual Studio's ADO functions.

private void PutRecord()
    string sRTFData;

    textControl1.Save(out sRTFData, TXTextControl.StringStreamType.RichTextFormat);
    dsRTFData.Tables[0].Rows[iCurrentRow][0] = sRTFData;
[Visual Basic]
Private Sub PutRecord()
    Dim sRTFData As String = String.Empty

    textControl1.Save(sRTFData, TXTextControl.StringStreamType.RichTextFormat)
    dsRTFData.Tables(0).Rows(iCurrentRow)(0) = sRTFData
End Sub

Other text formats can be used by simply changing the second parameter of the Save method.