2013-05-31 1 views
0

RichEditBox에 입력되는 내용을 저장하려고합니다. 아래는 나의 예입니다. "mytext.Text"를 사용하여 TextBox를 성공적으로 사용할 수 있었지만 RichEditBox에서 볼 수있는 옵션이 없습니다.Visual Basic에서 RichEditBox를 사용하여 파일을 저장하는 방법?

Private Async Function Button_Click(sender As Object, e As RoutedEventArgs) As Task 
    Dim savePicker As New FileSavePicker 
    savePicker.SuggestedStartLocation = PickerLocationId.DocumentsLibrary 
    ' Dropdown of file types the user can save the file as 

    savePicker.FileTypeChoices.Add(".txt", New List(Of String) From {".txt"}) 

    ' Default file name if the user does not type one in or select a file to replace 
    savePicker.SuggestedFileName = "New Document" 
    Dim file As StorageFile = Await savePicker.PickSaveFileAsync 
    If file IsNot Nothing Then 
     ' Prevent updates to the remote version of the file until we finish making changes and call CompleteUpdatesAsync 

     CachedFileManager.DeferUpdates(file) 
     ' Write to file 
     Await FileIO.WriteTextAsync(file, txtfile.) 
     ' Let Windows know that we are finished changing the file so the other app can update the remote version of the file. 
     ' Completing updates may require windows to ask for user input 
     Dim status As FileUpdateStatus = Await CachedFileManager.CompleteUpdatesAsync(file) 
    End If 

End Function 

답변

0

Windows.UI.Xaml.Controls.RichEditBox를 가정하면, 컨트롤의 Document 속성의 GetText 방법으로 텍스트를 검색 할 수 있습니다. Document 속성의 SaveToStream 메서드를 사용하여 문서를 직접 스트림에 쓸 수도 있습니다.

관련 문제