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. text-box control and plain text

text-box control and plain text

Scheduled Pinned Locked Moved Visual Basic
graphicshelpquestionlearning
4 Posts 3 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.
  • A Offline
    A Offline
    acecase
    wrote on last edited by
    #1

    Hey, I am trying to emplement a notepad type form into my application and I seen to be haveing a formatting problem. If I open the same .txt file useing notepad and with my editor the formatting is different. Mainly the whitespace seems to be off eg... (item:something price:25) in notepad is displayed as (item:something price:25) in my editor I counted the whitespace between each item in my editor and it doesn't seem to be the same with each one so its not standardizeing the whitespace or anything. I don't know what is causeing the difference. Here is the generated code for my textbox on the editor form (textField) Me.textField.AcceptsReturn = True Me.textField.AcceptsTab = True Me.textField.AllowDrop = True Me.textField.AutoSize = False Me.textField.Dock = System.Windows.Forms.DockStyle.Fill Me.textField.Font = New System.Drawing.Font("Bookman Old Style", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.textField.HideSelection = False Me.textField.Location = New System.Drawing.Point(0, 0) Me.textField.MaxLength = 0 Me.textField.Multiline = True Me.textField.Name = "textField" Me.textField.ScrollBars = System.Windows.Forms.ScrollBars.Both Me.textField.Size = New System.Drawing.Size(560, 323) Me.textField.TabIndex = 0 Me.textField.Text = "" Me.textField.WordWrap = False I am useing no wordwrap by default and have an option to turn it on but i have tried it with and without on both notepad and my editor and that doesn't seem to make a difference. Its important that my editor save and display text unformatted as Notepad does. Thanks in advance for any suggestions Harley EDIT: It just hit me that the way i read the data into the textbox may make a difference here so if it counts for anything i use... Dim name As String Dim title As String Dim text As String Dim path As String path = OpenFileDialog.FileName Dim sr As StreamReader = New StreamReader(path) text = sr.ReadToEnd() name = OpenFileDialog.FileName title = name newChild(Me, name, title, text) and of course i have a module for creating new MDI child forms with the textbox and I pass the value of text to that modules newChild sub wich then does a simple textField.text = text 'Where textField is the textbox in my editor form

    N 1 Reply Last reply
    0
    • A acecase

      Hey, I am trying to emplement a notepad type form into my application and I seen to be haveing a formatting problem. If I open the same .txt file useing notepad and with my editor the formatting is different. Mainly the whitespace seems to be off eg... (item:something price:25) in notepad is displayed as (item:something price:25) in my editor I counted the whitespace between each item in my editor and it doesn't seem to be the same with each one so its not standardizeing the whitespace or anything. I don't know what is causeing the difference. Here is the generated code for my textbox on the editor form (textField) Me.textField.AcceptsReturn = True Me.textField.AcceptsTab = True Me.textField.AllowDrop = True Me.textField.AutoSize = False Me.textField.Dock = System.Windows.Forms.DockStyle.Fill Me.textField.Font = New System.Drawing.Font("Bookman Old Style", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) Me.textField.HideSelection = False Me.textField.Location = New System.Drawing.Point(0, 0) Me.textField.MaxLength = 0 Me.textField.Multiline = True Me.textField.Name = "textField" Me.textField.ScrollBars = System.Windows.Forms.ScrollBars.Both Me.textField.Size = New System.Drawing.Size(560, 323) Me.textField.TabIndex = 0 Me.textField.Text = "" Me.textField.WordWrap = False I am useing no wordwrap by default and have an option to turn it on but i have tried it with and without on both notepad and my editor and that doesn't seem to make a difference. Its important that my editor save and display text unformatted as Notepad does. Thanks in advance for any suggestions Harley EDIT: It just hit me that the way i read the data into the textbox may make a difference here so if it counts for anything i use... Dim name As String Dim title As String Dim text As String Dim path As String path = OpenFileDialog.FileName Dim sr As StreamReader = New StreamReader(path) text = sr.ReadToEnd() name = OpenFileDialog.FileName title = name newChild(Me, name, title, text) and of course i have a module for creating new MDI child forms with the textbox and I pass the value of text to that modules newChild sub wich then does a simple textField.text = text 'Where textField is the textbox in my editor form

      N Offline
      N Offline
      Niels Penneman
      wrote on last edited by
      #2

      Use a System.IO.StreamWriter and specify filename and encoding. Maybe there's an encoding problem? greetz ;-) *Niels Penneman*


      Software/Dev Site
      Personal Site


      A 1 Reply Last reply
      0
      • N Niels Penneman

        Use a System.IO.StreamWriter and specify filename and encoding. Maybe there's an encoding problem? greetz ;-) *Niels Penneman*


        Software/Dev Site
        Personal Site


        A Offline
        A Offline
        acecase
        wrote on last edited by
        #3

        I'll give that a shot with ascii thanks UPDATE: I figured it out and now I feal stupid. Turns out it wasn't a formatting issue at all and my only problem was the diffence in fonts used in notepad and my editor. Thanks for the help 2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm..

        R 1 Reply Last reply
        0
        • A acecase

          I'll give that a shot with ascii thanks UPDATE: I figured it out and now I feal stupid. Turns out it wasn't a formatting issue at all and my only problem was the diffence in fonts used in notepad and my editor. Thanks for the help 2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm..

          R Offline
          R Offline
          Ray Cassick
          wrote on last edited by
          #4

          acecase wrote: 2 U.S. coins equal 30 cents and one is NOT a nickle. Hmm.. True, one is not a Nickel, the OTHER ONE is :-D


          Paul Watson wrote: "At the end of the day it is what you produce that counts, not how many doctorates you have on the wall." George Carlin wrote: "Don't sweat the petty things, and don't pet the sweaty things." Jörgen Sigvardsson wrote: If the physicists find a universal theory describing the laws of universe, I'm sure the asshole constant will be an integral part of that theory.


          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