text-box control and plain text
-
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
-
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
Use a
System.IO.StreamWriter
and specify filename and encoding. Maybe there's an encoding problem? greetz ;-) *Niels Penneman*
Software/Dev Site
Personal Site
-
Use a
System.IO.StreamWriter
and specify filename and encoding. Maybe there's an encoding problem? greetz ;-) *Niels Penneman*
Software/Dev Site
Personal Site
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..
-
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..
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.