Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / VB.NET / December 2005

Tip: Looking for answers? Try searching our database.

Public properties and displaying them on a form - Help Needed.

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Hexman - 07 Dec 2005 20:06 GMT
Well, back for another question.

I'm doing some calculations in a module (the reason in a module is
because it is an I-O module - reading csv files, Access DB, etc.). (If
not in a Module, where should I put them.)   From 'form1' I perform a
sub located in the module.  As I read files and calculate, I want to
display the statistics of the records read and their calculations.  I
posted a similar question a few days ago and was told to use
properties.  I searched for examples and here's what I have set up as
a test.

In form1:
   Public Property kkk() As String
       Get
           kkk = lblCntRecs.text
       End Get
       Set(ByVal Value As String)
           lblCntRecs.Text = Value
       End Set
   End Property

In the Module:
Module Module1
   Dim myform As New Form1
   Public Sub testit()
       Dim x As Long
       For x = 0 To 9000000
           If x Mod 1000 = 0 Then
               myform.kkk = x.ToString("###,##0")
           End If
       Next
   End Sub
End Module

The sub completes, but the label does not change during execution.
Only when the sub completes does the label change to the last value of
x.

What do I need to do to make the interim calcs/results appear on form1
during execution of the sub?

Hexman
I Don't Like Spam - 07 Dec 2005 21:46 GMT
> Well, back for another question.
>
[quoted text clipped - 38 lines]
>
> Hexman

Dim myform As New Form1
Here you create a new form1, not the one you are calling from.

To do it this way you need a setup like:
Public Sub testit(myform as Form1)

And when you call testit from form1 you call it like:
testit(me)

A better way to do it would be to have a callback function that you pass
into testit.  BTW: you won't get to see your processing because the
calcuation will eat up all the processor and you won't get a redraw.  I
think will fix it:
         Set(ByVal Value As String)
             lblCntRecs.Text = Value
        Me.Refresh
         End Set

If not then try Application.Doevents instead.

Chris
Hexman - 07 Dec 2005 23:50 GMT
>> Well, back for another question.
>>
[quoted text clipped - 60 lines]
>
>Chris

Chris,

Thanks alot.  Its now working by brute force.   The Me.Refresh did it.

>A better way to do it would be to have a callback function that you pass
>into testit.  

Can you either explain to me or point me in the direction to find out
what/how a callback function would work.

Thanks again

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.