PC Review


Reply
Thread Tools Rate Thread

View Data in Textbox

 
 
John Smith
Guest
Posts: n/a
 
      8th Dec 2004
I have a form doing a large process. While this form is doing its
processing I want to write a status to a Textbox of where it is at in the
process. Similar to having a log file but within a textbox. As it reaches
its mark it adds a line to the textbox "Step 2 is complete." or "Step 3
Failed because of...". My problem is that the text within the textbox does
not display until after all of the processing is complete. How can I get
the text to display when it reaches each specific process? Thanx in advance


 
Reply With Quote
 
 
 
 
Chris, Master of All Things Insignificant
Guest
Posts: n/a
 
      8th Dec 2004
Two ways. one and simple way is to use Application.DoEvents() after you
update the text box but a lot of people say to avoid using that function.
The more complicated way is to use threading to do the processing in a
seperate thread from the UI.

Chris


"John Smith" <(E-Mail Removed)> wrote in message
news:uzL%(E-Mail Removed)...
>I have a form doing a large process. While this form is doing its
> processing I want to write a status to a Textbox of where it is at in the
> process. Similar to having a log file but within a textbox. As it
> reaches
> its mark it adds a line to the textbox "Step 2 is complete." or "Step 3
> Failed because of...". My problem is that the text within the textbox
> does
> not display until after all of the processing is complete. How can I get
> the text to display when it reaches each specific process? Thanx in
> advance
>
>



 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      8th Dec 2004
John,

You mean something as this
\\\
Private Sub Form1_Activated(ByVal sender _
As Object, ByVal e As System.EventArgs) Handles MyBase.Activated
For i As Integer = 1 To 100000000
If i Mod 100 = 0 Then
TextBox1.Show()
End If
TextBox1.AppendText(i.ToString)
Next
End Sub
///

I hope this helps?

Cor


 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      8th Dec 2004
"John Smith" <(E-Mail Removed)> schrieb:
>I have a form doing a large process. While this form is doing its
> processing I want to write a status to a Textbox of where it is at in the
> process. Similar to having a log file but within a textbox. As it
> reaches
> its mark it adds a line to the textbox "Step 2 is complete." or "Step 3
> Failed because of...". My problem is that the text within the textbox
> does
> not display until after all of the processing is complete. How can I get
> the text to display when it reaches each specific process?


Solution 1:

\\\
With Me.Label1
.Text = ...
.Refresh()
End With
Application.DoEvents() ' See documentation.
///

Solution 2:

Multithreading + Windows Forms:

<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms06112002.asp>
<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms08162002.asp>
<URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms01232003.asp>

<URL:http://www.devx.com/dotnet/Article/11358/>

<URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsControlClassInvokeTopic.asp>

Multithreading in Visual Basic .NET (Visual Basic Language Concepts)
<URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconthreadinginvisualbasic.asp>

Sample:

FileSystemEnumerator
<URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
Chris, Master of All Things Insignificant
Guest
Posts: n/a
 
      8th Dec 2004
Herfried, maybe your example here can get you to answer a question I've
wondered about for a while.

With Me.Label1
.Text = ...
.Refresh()
End With

The idea behind the With clause is it allows for faster execution since the
"Me" ojbect doesn't have to be resolved 2 times in your example. But you
could rewrite your sample w/o the Me

With Label1
.Text = ...
.Refresh()
End With

In this case there wouldn't be any inhancement since you are not actually
eliminating the dot. Am I correct in my thinking?

Chris


"Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> "John Smith" <(E-Mail Removed)> schrieb:
>>I have a form doing a large process. While this form is doing its
>> processing I want to write a status to a Textbox of where it is at in the
>> process. Similar to having a log file but within a textbox. As it
>> reaches
>> its mark it adds a line to the textbox "Step 2 is complete." or "Step 3
>> Failed because of...". My problem is that the text within the textbox
>> does
>> not display until after all of the processing is complete. How can I get
>> the text to display when it reaches each specific process?

>
> Solution 1:
>
> \\\
> With Me.Label1
> .Text = ...
> .Refresh()
> End With
> Application.DoEvents() ' See documentation.
> ///
>
> Solution 2:
>
> Multithreading + Windows Forms:
>
> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms06112002.asp>
> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms08162002.asp>
> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms01232003.asp>
>
> <URL:http://www.devx.com/dotnet/Article/11358/>
>
> <URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsControlClassInvokeTopic.asp>
>
> Multithreading in Visual Basic .NET (Visual Basic Language Concepts)
> <URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconthreadinginvisualbasic.asp>
>
> Sample:
>
> FileSystemEnumerator
> <URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip>
>
> --
> M S Herfried K. Wagner
> M V P <URL:http://dotnet.mvps.org/>
> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>



 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      9th Dec 2004
Chris,

"Chris, Master of All Things Insignificant" <chris@No_Spam_Please.com>
schrieb:
> Herfried, maybe your example here can get you to answer a question I've
> wondered about for a while.
>
> With Me.Label1
> .Text = ...
> .Refresh()
> End With
>
> The idea behind the With clause is it allows for faster execution since
> the "Me" ojbect doesn't have to be resolved 2 times in your example. But
> you could rewrite your sample w/o the Me
>
> With Label1
> .Text = ...
> .Refresh()
> End With
>
> In this case there wouldn't be any inhancement since you are not actually
> eliminating the dot. Am I correct in my thinking?


The 'Me.' is resolved even if it's not explicitly written. In this case I
used With type the code faster ;-).

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      9th Dec 2004
Chis,

Not true,

The "Me" is only for the programmer, it does nothing at runtime.

The With clause creates an extra reference in a program. In this case it
will be slower than a program without a With clause, however think than
probably in parts of nanoseconds.

I hope this gives some ideas?

Cor


"Chris, Master of All Things Insignificant"
..
> Herfried, maybe your example here can get you to answer a question I've
> wondered about for a while.
>
> With Me.Label1
> .Text = ...
> .Refresh()
> End With
>
> The idea behind the With clause is it allows for faster execution since
> the "Me" ojbect doesn't have to be resolved 2 times in your example. But
> you could rewrite your sample w/o the Me
>
> With Label1
> .Text = ...
> .Refresh()
> End With
>
> In this case there wouldn't be any inhancement since you are not actually
> eliminating the dot. Am I correct in my thinking?
>
> Chris
>
>
> "Herfried K. Wagner [MVP]" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> "John Smith" <(E-Mail Removed)> schrieb:
>>>I have a form doing a large process. While this form is doing its
>>> processing I want to write a status to a Textbox of where it is at in
>>> the
>>> process. Similar to having a log file but within a textbox. As it
>>> reaches
>>> its mark it adds a line to the textbox "Step 2 is complete." or "Step 3
>>> Failed because of...". My problem is that the text within the textbox
>>> does
>>> not display until after all of the processing is complete. How can I
>>> get
>>> the text to display when it reaches each specific process?

>>
>> Solution 1:
>>
>> \\\
>> With Me.Label1
>> .Text = ...
>> .Refresh()
>> End With
>> Application.DoEvents() ' See documentation.
>> ///
>>
>> Solution 2:
>>
>> Multithreading + Windows Forms:
>>
>> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms06112002.asp>
>> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms08162002.asp>
>> <URL:http://msdn.microsoft.com/library/en-us/dnforms/html/winforms01232003.asp>
>>
>> <URL:http://www.devx.com/dotnet/Article/11358/>
>>
>> <URL:http://msdn.microsoft.com/library/en-us/cpref/html/frlrfSystemWindowsFormsControlClassInvokeTopic.asp>
>>
>> Multithreading in Visual Basic .NET (Visual Basic Language Concepts)
>> <URL:http://msdn.microsoft.com/library/en-us/vbcn7/html/vaconthreadinginvisualbasic.asp>
>>
>> Sample:
>>
>> FileSystemEnumerator
>> <URL:http://dotnet.mvps.org/dotnet/samples/filesystem/downloads/FileSystemEnumerator.zip>
>>
>> --
>> M S Herfried K. Wagner
>> M V P <URL:http://dotnet.mvps.org/>
>> V B <URL:http://dotnet.mvps.org/dotnet/faqs/>

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Autofilling a textbox and entering data in a textbox. pawojczak Microsoft Access Forms 1 9th Sep 2009 06:16 AM
Copy Textbox data to Textbox in Other File Troubled User Microsoft Excel Programming 2 6th Oct 2008 06:42 PM
Create array of Textbox Dynamically and retrieve data from that textbox in asp .net Raju Microsoft C# .NET 1 8th Feb 2006 03:33 PM
Create array of Textbox Dynamically and retrieve data from that textbox in asp .net Raju Microsoft C# .NET 0 8th Feb 2006 07:17 AM
VB-6 Textbox data field Vs .Net Textbox property ? Luqman Microsoft VB .NET 2 2nd Jan 2006 09:08 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:02 PM.