Click here to Skip to main content
15,899,679 members
Home / Discussions / C#
   

C#

 
AnswerRe: Textbox Error/Problem? Pin
mnvkng7626-Apr-07 17:07
mnvkng7626-Apr-07 17:07 
GeneralRe: Textbox Error/Problem? Pin
Gareth H26-Apr-07 22:24
Gareth H26-Apr-07 22:24 
QuestionMysql Hash Password? Pin
Eddymvp26-Apr-07 6:55
Eddymvp26-Apr-07 6:55 
AnswerRe: Mysql Hash Password? Pin
Guffa26-Apr-07 11:14
Guffa26-Apr-07 11:14 
GeneralRe: Mysql Hash Password? Pin
Eddymvp27-Apr-07 4:58
Eddymvp27-Apr-07 4:58 
AnswerRe: Mysql Hash Password? Pin
Guffa27-Apr-07 8:35
Guffa27-Apr-07 8:35 
Questionautocomplete feature Pin
Adobe200726-Apr-07 5:35
Adobe200726-Apr-07 5:35 
AnswerRe: autocomplete feature Pin
led mike26-Apr-07 5:40
led mike26-Apr-07 5:40 
GeneralRe: autocomplete feature Pin
Adobe200726-Apr-07 5:43
Adobe200726-Apr-07 5:43 
GeneralRe: autocomplete feature Pin
Mark Greenwood26-Apr-07 13:26
Mark Greenwood26-Apr-07 13:26 
GeneralRe: autocomplete feature Pin
Adobe200728-Apr-07 13:16
Adobe200728-Apr-07 13:16 
QuestionFolderBrowserDialog.SelectedPath Pin
Soulprovider26-Apr-07 4:48
Soulprovider26-Apr-07 4:48 
AnswerRe: FolderBrowserDialog.SelectedPath Pin
althamda26-Apr-07 5:25
althamda26-Apr-07 5:25 
GeneralRe: FolderBrowserDialog.SelectedPath Pin
Soulprovider28-May-07 23:51
Soulprovider28-May-07 23:51 
AnswerRe: FolderBrowserDialog.SelectedPath Pin
jayart26-Apr-07 23:48
jayart26-Apr-07 23:48 
QuestionHow Inherits...Implements...in C# Pin
ASysSolvers26-Apr-07 4:38
ASysSolvers26-Apr-07 4:38 
AnswerRe: How Inherits...Implements...in C# Pin
Colin Angus Mackay26-Apr-07 5:26
Colin Angus Mackay26-Apr-07 5:26 
GeneralRe: How Inherits...Implements...in C# Pin
Scott Dorman26-Apr-07 5:32
professionalScott Dorman26-Apr-07 5:32 
GeneralRe: How Inherits...Implements...in C# Pin
Colin Angus Mackay26-Apr-07 5:44
Colin Angus Mackay26-Apr-07 5:44 
GeneralRe: How Inherits...Implements...in C# Pin
ASysSolvers26-Apr-07 5:50
ASysSolvers26-Apr-07 5:50 
AnswerRe: How Inherits...Implements...in C# Pin
Scott Dorman26-Apr-07 5:31
professionalScott Dorman26-Apr-07 5:31 
GeneralRe: How Inherits...Implements...in C# Pin
ASysSolvers26-Apr-07 5:53
ASysSolvers26-Apr-07 5:53 
AnswerRe: How Inherits...Implements...in C# Pin
ASysSolvers27-Apr-07 5:33
ASysSolvers27-Apr-07 5:33 
QuestionMove scrollable pane from function Pin
Stumproot26-Apr-07 3:42
Stumproot26-Apr-07 3:42 
Generalsetting large amount of text in textbox Pin
V.26-Apr-07 2:56
professionalV.26-Apr-07 2:56 
Guys,

A few days ago I asked about an assignment we had to do here at work. convert "aabb" to "aAbB" and set it to the textbox as quickly as possible. I think the conversion itself is very quick, reading in and converting in 1 or 2 seconds, but setting the entire thing in the texbox takes me another 10 seconds! (20 MB file)

I've read about the AppendText property and tried to set my characterarray to the box inside my loop, but so far the fastest results I got where form txtbox_result.Text = new string(text); where text = char [].

Any ideas on how to speed this up? (Suspend/resumelayout don't help either)

thanks !


PS: here's tho code I got so far:
starttime = DateTime.Now;
reader = new System.IO.StreamReader(openfiledlg.FileName);
char [] text = reader.ReadToEnd().ToCharArray();
reader.Close();
difference = DateTime.Now - starttime;
lbl_result.Text = "File read: " + difference.TotalMilliseconds + " milliseconds.";
lbl_result.Refresh();
pb_conversion.Maximum = text.Length;
//Starting from 1 will gain me 1 character less to analyze.
//don't update the progress bar every iteration.
int i2 = 0;
for(int i = 1; i < text.Length; i+=2){
    text[i] = char.ToUpper(text[i]);
    if(++i2 == 1000){
        i2 = 0;
        pb_conversion.Value = i;
    }                                           //end if
}                                               //end for
difference = DateTime.Now - starttime;
lbl_result.Text = "conversion: " + difference.TotalMilliseconds + " milliseconds.";
lbl_result.Refresh();
pb_conversion.Value = pb_conversion.Maximum;
txtbox_result.SuspendLayout();
txtbox_result.Text = new string(text);
txtbox_result.ResumeLayout();
difference = DateTime.Now - starttime;
lbl_result.Text = "Done in: " + difference.TotalMilliseconds + " milliseconds.";




V.
I found a living worth working for, but haven't found work worth living for.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.