Wrox Programmer Forums
|
Beginning VB 6 For coders who are new to Visual Basic, working in VB version 6 (not .NET).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning VB 6 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 26th, 2009, 05:24 AM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
Default Label Refresh

Hi; I have a timer that executes my start button every 15 minutes which works fine but now I want the labels to refresh at the same time. I’ve played around a bit but and did search other posts but can’t seem to get it right, here’s what I’ve got.

Code:
Private Sub tmrMinute_Timer()
MinCount = MinCount + 1
Label1.Caption = MinCount
If (MinCount = 15) Then
Call cmdstart_Click
MinCount = 0
End If
lblMsgA.Refresh
lblMsgB.Refresh
lblMsgC.Refresh
lblMsgD.Refresh
End Sub
 
Old October 26th, 2009, 09:14 AM
Authorized User
 
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Those labels will only be refreshed after the code in the button has been executed. If you are wanting them to be updated while/from information from that code then you should put the refresh statements within that code or perhaps the dreaded by some, DoEvents.



Good Luck
 
Old October 28th, 2009, 04:48 AM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks for that I have play around but can’t seem to get it right I don’t get the doevent that well where must I put it to do something because it’s not doing anything where it is now

Code:
Private Sub cmdstart_Click()
If lblMsgD <= 1000 Then
Dim olmahApp As Outlook.Application
   Set olmahApp = CreateObject("Outlook.Application")
    

   Dim olmahNs As Outlook.Namespace
   Set olmahNs = olmahApp.GetNamespace("MAPI")
   olmahNs.Logon
   

   Dim olmahMail As Outlook.MailItem
   Set olmahMail = olmahApp.CreateItem(olmahMailItem)
   olmahMail.To = "some@one.gov.za"
   olmahMail.Subject = "VB TEST"
   olmahMail.Body = _
        "Good Day Magoveni Holdings" & ", " & vbCr & vbCr & vbTab & _
        "Please note that your credit is all most finish ." & ", " & vbCr & vbCr & vbTab & _
        "Many Thanks"
   olmahMail.Send
   olmahNs.Logoff
   Set olmahNs = Nothing
   Set olmahMail = Nothing
   Set olmahApp = Nothing
End If
DoEvents
lblMsgA.Refresh
End Sub


Private Sub tmrMinute_Timer()
MinCount = MinCount + 1
Label1.Caption = MinCount
If (MinCount = 10) Then
Call cmdstart_Click
MinCount = 0
End If
End Sub
 
Old October 28th, 2009, 07:46 AM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Hi, I think I know what my problem is I need to refresh the form or the Adodc because the label gets updated from the date base throw the Adodc any suggestions will be appreciated
 
Old October 28th, 2009, 10:40 AM
Authorized User
 
Join Date: Mar 2009
Posts: 49
Thanks: 0
Thanked 8 Times in 8 Posts
Default

Okay, if the label is bound to the ADODC then it is the ADODC that you need to refresh and if you do use this you will need to be able to keep track of where you are presently at in the recordset so you can move back to the current record you want to display...



Good Luck
The Following User Says Thank You to vb5prgrmr For This Useful Post:
Janos (October 29th, 2009)
 
Old October 29th, 2009, 01:35 AM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks for the reply, Im only interested in the available credit left and the query in th record source provides that for me and display it in the label but this availble credit change every second so my goal is to refresh the ADODC lets say every 10 minutes. I’ve tried a couple of things but cant get it right how does n person go by doing this im lost here

Last edited by Janos; October 29th, 2009 at 02:06 AM..
 
Old October 29th, 2009, 08:38 AM
Authorized User
 
Join Date: Oct 2009
Posts: 10
Thanks: 2
Thanked 0 Times in 0 Posts
Default

Thanks for the afford and the replays I got it sorted

Code:
 
adoeas.RecordSource = "select unit_id, (CREDIT_UPPER_LIMIT - CREDIT_ISSUED)Available_Credit from CREDIT_LIMIT where unit_id = 16251"
adoeas.Refresh





Similar Threads
Thread Thread Starter Forum Replies Last Post
how to see a label hombre Java Basics 3 March 4th, 2008 06:15 AM
Refresh GridView Using Refresh Button msbsam ASP.NET 2.0 Professional 0 December 6th, 2006 05:57 AM
Detect associated label ysiline Access VBA 1 April 26th, 2006 07:16 AM
label in repeater boomsoftware@gmail.com ASP.NET 1.0 and 1.1 Basics 0 April 13th, 2006 09:38 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.