Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Question on pure visual basic

Question on pure visual basic

Scheduled Pinned Locked Moved Visual Basic
helpquestiondatabase
2 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rajrajeshwar
    wrote on last edited by
    #1

    hi, anyone kindly help me out? i want to load multiple files using richtextbox loadfile option(rtf.LoadFile) and all the contents of the files will come one by one and shown in the richtextbox in lines.there may be informations from the database also.what i'm doing, every time, the last file is loaded and overridden on the previous one.thus the contents of the last file being loaded are shown.i think if i can insert a newline between files being loaded then it will work.but standard newline property like vbcrlf didn't work.kindly help.this is urgent.thank you for reading this problem patiently.

    D 1 Reply Last reply
    0
    • R rajrajeshwar

      hi, anyone kindly help me out? i want to load multiple files using richtextbox loadfile option(rtf.LoadFile) and all the contents of the files will come one by one and shown in the richtextbox in lines.there may be informations from the database also.what i'm doing, every time, the last file is loaded and overridden on the previous one.thus the contents of the last file being loaded are shown.i think if i can insert a newline between files being loaded then it will work.but standard newline property like vbcrlf didn't work.kindly help.this is urgent.thank you for reading this problem patiently.

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      The reason your text is getting over-written is because LoadFile scraps everything in the control before the new file is loaded. Your going to need 2 RichTextBoxes, one visible, and one not. What you do is tell the hidden RichTextBox to do the LoadFile, then copy and paste the contents of the hidden RichTextBox to the Visible one. Add your blank line to the end of the visible RichTextBox, start over again. Here is a little pseudo-code:

      ' RichTextBox1 is Visible, RichTextBox2 is not.
      ' And make sure RichTextBox1 is cleared of text first.
      RichTextBox1.Visible = True
      RichTextBox2.Visible = False
      RichTextBox1.Clear()

      ' Now, for each filename:
      ' Have the hidden RTB (RichTextBox2) load the file we want
      ' then, select all the text in it
      ' then, tell the visible RTB (RichTextBox1) to Append the SelectedText in the hidden RTB
      ' and then, append a blank line to the bottom of the text.
      For Each Filename
      RichTextBox2.LoadFile(filename)
      RichTextBox2.SelectAll()
      RichTextBox1.AppendText(RichTextBox2.SelectedText)
      RichTextBox1.AppendText(vbCrLf)
      Next

      RageInTheMachine9532

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups