473,378 Members | 1,489 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

HELP: writing to RichTextBox



Hello,

I have been working on this piece of code that's supposed to read from a
file - transform - preview and finally save the transformed data.

I can read the file and with RichtextBox.LoadFile( ) i can display it on
the first box.

Then, in a for loop i read line by line , extract the information and (the
idea is) to put the transformed data in another RichText Box so that the
user can decide wether to save them in a file or not.

However i noticed that with files of around 1Meg and more , the process
slows down and freezes ! There is no exception raised, or i don't see it in
my Try block ... , the MaxSize for the textbox cannot be increased futher,
and I have tried everything except calling the CG explicitly but i don't see
the point in this piece of code.

Please help. I have spend hours on this and can't figure out what could be
wrong.

TIA

************************************************** *****************

Try 'Put writing loop in a try-catch block

'*********************************************

'Main Loop over all lines of Global ArrayList

'------------- STEP 1 ------------------------

' -- READ data from global array into structure

For Each LineStr In globalArrayListIN

'Check each line length IF different than 233

If (LineStr.Length = 234 Or LineStr.Length = 233) Then

'increase progress bar

pbrTransform.Value += 1

'extract Station ID , year , month , element code

tempLine.stationID = LineStr.Substring(0, 7)

tempLine.year = LineStr.Substring(7, 4)

tempLine.month = LineStr.Substring(11, 2)

tempLine.element = LineStr.Substring(13, 3)

'Loop in order to get data for the 31 days of the month on the same line

For i As Integer = 0 To 30

tempLine.value(i) = LineStr.Substring(16 + (i * 7), 7)

Next

'------------- STEP 2 ------------------------

'-- ADD lines to the Transformed preview pane

rtbTransformed.AppendText(tempLine.stationID)

rtbTransformed.AppendText(delimiter + tempLine.year)

rtbTransformed.AppendText(delimiter + tempLine.month)

rtbTransformed.AppendText(delimiter + tempLine.element)

For i As Integer = 0 To 3

rtbTransformed.AppendText(delimiter + tempLine.value(i))

Next

rtbTransformed.AppendText(vbCrLf)

'IF file format is NOT correct, advise user and exit loop

Else

MsgBox("Le fichier n'as pas le propre format de 234 characters par ligne." +
vbCrLf + "SVP essayer de nouveau.")

Exit For

End If

Next

Catch ex As Exception

MsgBox(ex.ToString)

Finally

pbrTransform.Value = 0 'clear progress bar

End Try
Nov 21 '05 #1
0 1465

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: PC User | last post by:
I found some VB code to printout a richtext field and I'm trying to adapt it to MS Access 2000. I think there might be some small changes to make the adaption between VB versions. Also my OS is...
2
by: Matt Rudder | last post by:
Hello all, I'm currently writing a program in which I need a textbox control, similar to the code editor in .NET. but with line numbers and such. I can't find anything third-party that even...
3
by: Francesc | last post by:
Hi, After some years programming libraries and web based applications I'm trying to program my first not-silly windows application (something similar to an editor but just to annotate text...
6
by: Martin Heuckeroth | last post by:
Hi, We are looking for a way to determine the x and y points of the cursor in a richtext box. We made an VB.NET application with a couple of listboxes and one of them is a richtextlistbox....
0
by: Srig007 via DotNetMonster.com | last post by:
I am having a hard time trying to display characters into the richtextbox everytime I drag a button into it. I successfully got the button to be dragged and dropped into the richtextbox, but I...
6
by: cj | last post by:
Lets just take this example I'm looking at now. I'm looking at the help screen titled .NET Framework Class Library FolderBrowserDialog Class . It gives an example at the bottom that begins with:...
40
by: apprentice | last post by:
Hello, I'm writing an class library that I imagine people from different countries might be interested in using, so I'm considering what needs to be provided to support foreign languages,...
8
by: Lee | last post by:
Hi all, I'm trying to programatically change the background color of lines of text and running into a few difficulties, anyone got any suggestions? my relevant code is as follows: public void...
0
by: Vimalathithan | last post by:
I just developing a editor. I have provide the options like Bold, Italic, underlin, font change, font size change. These font options are keep in with one toolstripbutton. the toolstripbar keep...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.