Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8733125
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T09:35:00+00:00 2026-06-13T09:35:00+00:00

Hi I am trying to open and view a files text in a rich

  • 0

Hi I am trying to open and view a files text in a rich text box. Here is what I have please let me know what I am doing wrong?

Private Sub loadButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles loadButton.Click

    ' Displays an OpenFileDialog so the user can select a Cursor.
    Dim openFileDialog1 As New OpenFileDialog()
    openFileDialog1.Filter = "Cursor Files|*.txt"
    openFileDialog1.Title = "Select a Cursor File"

    If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
        ' Assign the cursor in the Stream to the Form's Cursor property.
        Me.mainRTBox = New Text(openFileDialog1.OpenFile())
    End If

End Sub
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T09:35:01+00:00Added an answer on June 13, 2026 at 9:35 am

    The problem you were having was that you weren’t reading the file at all, and you weren’t assigning the content of the file to the RichTextBox correctly.

    Specifically, this code you have:

    Me.mainRTBox = New Text(openFileDialog1.OpenFile())

    .. should be:

    Me.mainRTBox.Text = FileIO.FileSystem.ReadAllText(openFileDialog1.FileName)

    This code will work:

    Public Class Form1
    
        Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
            ' Displays an OpenFileDialog so the user can select a Cursor.
            Dim openFileDialog1 As New OpenFileDialog()
            openFileDialog1.Filter = "Cursor Files|*.cur"
            openFileDialog1.Title = "Select a Cursor File"
    
            If openFileDialog1.ShowDialog() = System.Windows.Forms.DialogResult.OK Then
                ' Assign the cursor in the Stream to the Form's Cursor property.
    
                Dim extension = openFileDialog1.FileName.Substring(openFileDialog1.FileName.LastIndexOf("."))
    
                If extension Is "cur" Then
                    Me.mainRTBox.Text = FileIO.FileSystem.ReadAllText(openFileDialog1.FileName)
                End If
    
            End If
        End Sub
    End Class
    

    Edit: I updated the code so that it checks if the user did actually open a Cur (cursor) file.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to open UIImagePickerController from 3 different view controllers. but the problem
I´m trying to open a tab using jquery, here is my code: $(#ecContenedorFolders).tabs({ tabTemplate:
I am trying to open old files which are logged long time ago but
Here is some code that I'm trying to make save some UITextView text. When
i have a big file in text format who i trying to read through
I'm trying to read Excel to data grid view without doing hard coding style.
i currently trying to view all the files and folder selected by the user
I'm trying to read/write files to the sdcard. I've tried doing this both on
I can get one successful Open Flash Chart per view. I'm now trying to
I am trying open a new window using url.Action. And the new Window url

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.