PC Review


Reply
Thread Tools Rate Thread

access a form a class that the form has called

 
 
Cath Victor
Guest
Posts: n/a
 
      15th Dec 2003
Hi...

I have a windows form that calls/uses a class to do some processing. I
want this class to return values or append text to the form's textbox as
it processes data. Any of you guys know how I could do this?

I was already able to do this before but unfortunately, my code has been
deleted and I can't reconstruct it.

Thank you very very much...

Cath

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

 
Reply With Quote
 
 
 
 
Armin Zingler
Guest
Posts: n/a
 
      15th Dec 2003
"Cath Victor" <(E-Mail Removed)> schrieb
>
> I have a windows form that calls/uses a class to do some processing.
> I want this class to return values or append text to the form's
> textbox as it processes data. Any of you guys know how I could do
> this?
>
> I was already able to do this before but unfortunately, my code has
> been deleted and I can't reconstruct it.


In the class, raise an event. In the Form, handle the event and update the
display. It you don't need to use the Form during the process, it is
sufficient to call the Refresh method of the controls that need to be
refreshed.

ATTENTION: Using WinXP, calling the Refresh method does not refresh the
control after a couple of seconds. Reason: (3rd paragraph)
http://msdn.microsoft.com/library/en...sagequeues.asp

This annoying "feature" can not be turned off (AFAIK)! There is no way to
update the display only. Either you have to use Application.Doevents (which
also enables the user to interact with the Form - what you might not want),
or you have to do the job in a new thread.


--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

 
Reply With Quote
 
Cor
Guest
Posts: n/a
 
      15th Dec 2003
Hi Cath,

You are a very lucky guy (or girl)

The group had some fun and Armin got a challenge, he did contribute it about an hour ago, it is in this group. It even goes with a picture, you have to make it yourself with text.

I did copy it for you (and tested it) it is only a sample

\\\q&d needs a panel on a form
Private m_StartTicks As Integer = Environment.TickCount
Private m_Bmp As New Bitmap( _
"G:\enterthepathwherethebitmapcanbefound\Bitmap1.bmp" _
)

Private Sub Timer1_Tick( _
ByVal sender As System.Object, _
ByVal e As System.EventArgs) _
Handles Timer1.Tick

UpdatePanel()
End Sub

Private Sub UpdatePanel()
Dim Diff As Integer
Dim g As Graphics
Diff = Environment.TickCount - m_StartTicks
g = Me.Panel1.CreateGraphics
g.DrawImage( _
m_Bmp, 0, 0, _
New Rectangle( _
0, Diff \ 20, Me.Panel1.Width, Me.Panel1.Height _
), GraphicsUnit.Pixel _
)
g.Dispose
'TODO: watch exceeding the bitmap's height and
'implement a loop
End Sub

Private Sub Panel1_Paint( _
ByVal sender As Object, _
ByVal e As System.Windows.Forms.PaintEventArgs) _
Handles Panel1.Paint

UpdatePanel()
End Sub

and: timer1.interval=100


If you want it *really* smooth it occupies some more cpu power: (also q&d)

Shared Sub main()
'I never use "Call", but "(New Form1).ShowDialog"
'does not work
Call (New Form1).ShowDialog()
End Sub

Public Shadows Sub ShowDialog()

Dim rect As Rectangle
Dim StartTicks As Integer

Me.Show()
Me.Refresh()

rect.Width = Me.Panel1.Width
rect.Height = Me.Panel1.Height

StartTicks = Environment.TickCount

Do
Dim Diff, Y As Integer
Dim g As Graphics
Diff = Environment.TickCount - StartTicks
rect.Y = Diff \ 20
'TODO: same todo as above...
g = Panel1.CreateGraphics
g.DrawImage(m_Bmp, 0, 0, rect, GraphicsUnit.Pixel)
g.Dispose()
Application.DoEvents()
Loop While Me.Created

End Sub


I hope this helps a little bit?

(compliments to Armin)

Cor


 
Reply With Quote
 
Armin Zingler
Guest
Posts: n/a
 
      15th Dec 2003
"Cor" <(E-Mail Removed)> schrieb

> (compliments to Armin)


Aaahh, no, it's q&d (and declared as q&d).

:-)


--
Armin

 
Reply With Quote
 
Herfried K. Wagner [MVP]
Guest
Posts: n/a
 
      15th Dec 2003
* Cath Victor <(E-Mail Removed)> scripsit:
> I have a windows form that calls/uses a class to do some processing. I
> want this class to return values or append text to the form's textbox as
> it processes data. Any of you guys know how I could do this?
>
> I was already able to do this before but unfortunately, my code has been
> deleted and I can't reconstruct it.


See:

<http://groups.google.com/groups?selm=uh87DfymDHA.3504%40TK2MSFTNGP11.phx.gbl>

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
 
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
How to access a class in a form declared public in another form Esperanza Microsoft C# .NET 3 13th Jun 2005 08:02 PM
Newbie question: Form called by add-in doesn't have access to application Bernhard Microsoft VB .NET 3 12th Jan 2005 11:16 PM
Re: Access 2000 - Halt execution of a subroutine until called form is Rick Brandt Microsoft Access Form Coding 0 12th Jul 2004 07:55 PM
Form's Move event from derived class getting called 3 times instead of once Augie Microsoft Dot NET Framework Forms 3 20th May 2004 10:26 PM
Label not showing up on gui form called from within load handler of other form gs_sarge@yahoo.com Microsoft Dot NET Framework Forms 1 11th Feb 2004 07:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:32 PM.