10 Replies - 12001 Views - Last Post: 03 August 2008 - 07:22 PM Rate Topic: -----

#1 j0hnrAiner  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 54
  • Joined: 24-July 07

msgbox with timer

Posted 29 July 2008 - 08:35 PM

hi guys.. is it possible to make a msgbox box with timer? the user will need not to press the msgbox in order to execute the next line of the program.. i try this but i got wrong expected output..
msgbox timer1



help me guys pls.. tnx..
Is This A Good Question/Topic? 0
  • +

Replies To: msgbox with timer

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4308
  • View blog
  • Posts: 12,088
  • Joined: 18-April 07

Re: msgbox with timer

Posted 29 July 2008 - 08:50 PM

Well first you have to setup the timer's tick event which in there you call the message box. However, the msgbox is modal meaning that it requires the user to interact with it before it continues to process any other lines of code. So you will have to come up with another way to do what you are looking to do.

But you really have to ask yourself if showing a message box every so many ticks on the timer is even a good idea. You shouldn't hit the user with msgboxes like this. Reserve the messagebox only for showing extremely important information that would the intervention of the user.

If you want to elaborate on what you are attempting to do, perhaps we can help further.

Hope that helps you make the correct design choice. :)
Was This Post Helpful? 0
  • +
  • -

#3 j0hnrAiner  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 54
  • Joined: 24-July 07

Re: msgbox with timer

Posted 29 July 2008 - 09:01 PM

View PostMartyr2, on 29 Jul, 2008 - 08:50 PM, said:

Well first you have to setup the timer's tick event which in there you call the message box. However, the msgbox is modal meaning that it requires the user to interact with it before it continues to process any other lines of code. So you will have to come up with another way to do what you are looking to do.

But you really have to ask yourself if showing a message box every so many ticks on the timer is even a good idea. You shouldn't hit the user with msgboxes like this. Reserve the messagebox only for showing extremely important information that would the intervention of the user.

If you want to elaborate on what you are attempting to do, perhaps we can help further.

Hope that helps you make the correct design choice. :)


tnx for the reply..

my real problem is this..
i hav this difficulty in refreshing the database..
i hav two option button which will display daily record and monthly record respectivetly.. when i press the option 1 the daily records appear but once i pressed the second button, this where my problem occurs, it did not display the monthly reports, i must terminate first my progrma then re-do what i did.. what shuold i do with this? help me pls.. hope you understood what i meant.. bad english..
Was This Post Helpful? 0
  • +
  • -

#4 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4308
  • View blog
  • Posts: 12,088
  • Joined: 18-April 07

Re: msgbox with timer

Posted 29 July 2008 - 09:05 PM

Is this straight VB6 or are you implementing this through Excel/Access etc? Are you using crystal reports? Can you show us your code that is giving you the problems?

Thanks. :)
Was This Post Helpful? 0
  • +
  • -

#5 j0hnrAiner  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 54
  • Joined: 24-July 07

Re: msgbox with timer

Posted 29 July 2008 - 10:10 PM

View PostMartyr2, on 29 Jul, 2008 - 09:05 PM, said:

Is this straight VB6 or are you implementing this through Excel/Access etc? Are you using crystal reports? Can you show us your code that is giving you the problems?

Thanks. :)


heres my code:
Private Sub Option1_Click()
Dim rs1 As New Recordset

ucon.Execute "Delete * from Tmp"

Set urec = Nothing

urec.Open "select * from courses", ucon, adOpenForwardOnly, adLockOptimistic

With urec

Do While Not .EOF
	If CDate(urec.Fields("datee")) = Date Then
	   Set rs1 = Nothing
		  rs1.Open "Select * from Tmp", ucon, adOpenDynamic, adLockOptimistic
		   rs1.AddNew
		   rs1!studnum = urec.Fields("course")
		   rs1!numhr = urec.Fields("total")
		   rs1!course = urec.Fields("datee")
		   rs1.UpdateBatch adAffectCurrent
		  
	 Else
	 End If
		 .MoveNext
Loop
		 
End With
		
	   
		MsgBox ("rEADY FOR pRINTING")
		
		With rs1
			DataReport2.Show
		End With
		
		'With DataEnvironment1.rscourse
		'	 If .State = adStateClosed Then .Open
		'		.Requery
		'		.Requery
		'		urec.Requery
		'
		'		DataReport2.Show
		'
		'End With
		
	'With DataReport1.Sections("Section4")
	'	.Controls("label14").Caption = "Daily Report"
	'End With

Option1.Value = False
End Sub

Private Sub Option2_Click()
Dim rs2 As New Recordset

ucon.Execute "Delete * from Tmp"
ucon.Execute "Delete * from Tmp"

Set urec = Nothing

urec.Open "select * from courses", ucon, adOpenForwardOnly, adLockOptimistic

With urec

Do While Not .EOF
	If Format(Month(urec.Fields("datee"))) = Format(Month(Now)) Then
	
	Set rs2 = Nothing
		  rs2.Open "Select * from Tmp", ucon, adOpenDynamic, adLockOptimistic
		   rs2.AddNew
		   rs2!studnum = urec.Fields("course")
		   rs2!numhr = urec.Fields("total")
		   rs2!course = urec.Fields("datee")
		   rs2.UpdateBatch adAffectCurrent
		  
	 Else
	 End If
		 .MoveNext
Loop
		 
End With
		
		MsgBox ("rEADY FOR pRINTING")
		
		With rs2
			DataReport2.Show
		End With
		
		'With DataEnvironment1.rscourse
		'	 If .State = adStateClosed Then .Open
		'		.Requery
		'		.Requery
		'		urec.Requery
		'		DataReport2.Show
				
		'End With
		
	'With DataReport1.Sections("Section4")
	'	.Controls("label14").Caption = "Monthly Report"
	'End With
Option2.Value = False
End Sub




i think, theres nothing wrong with the code, because it saves the data on the database, my only problem is displaying the correct data upon pressing the option button.. tell me pls.., if where i got wrong.. tnx..
Was This Post Helpful? 0
  • +
  • -

#6 khlee04  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-July 08

Re: msgbox with timer

Posted 29 July 2008 - 10:37 PM

View Postj0hnrAiner, on 29 Jul, 2008 - 08:35 PM, said:

hi guys.. is it possible to make a msgbox box with timer? the user will need not to press the msgbox in order to execute the next line of the program.. i try this but i got wrong expected output..
msgbox timer1



help me guys pls.. tnx..

please you use Windows Api

Private Declare Function MessageBoxTimeout Lib "user32.dll" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal uType As Long, _
ByVal wLanguageId As Long, _
ByVal dwMilliseconds As Long _
) As Long

Private Const IDYES& = 6&
Private Const IDNO& = 7&
Private Const MB_SETFOREGROUND& = &H10000
Private Const MB_YESNO& = &H4&
Private Const MB_ICONASTERISK& = &H40&
Private Const MB_TIMEDOUT& = &H7D00&

Private Sub Form_Load()
Dim lRet As Long
lRet = MessageBoxTimeout(0&, "your message", _
"Timeout MessageBox Test", MB_SETFOREGROUND Or MB_YESNO Or MB_ICONASTERISK, _
0&, 10000&)

Select Case lRet
Case IDYES:
'// your code
Case IDNO:
'// your code

Case MB_TIMEDOUT:
'// your code

End Select
End Sub
Was This Post Helpful? 0
  • +
  • -

#7 j0hnrAiner  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 54
  • Joined: 24-July 07

Re: msgbox with timer

Posted 29 July 2008 - 11:02 PM

View Postkhlee04, on 29 Jul, 2008 - 10:37 PM, said:

View Postj0hnrAiner, on 29 Jul, 2008 - 08:35 PM, said:

hi guys.. is it possible to make a msgbox box with timer? the user will need not to press the msgbox in order to execute the next line of the program.. i try this but i got wrong expected output..
msgbox timer1



help me guys pls.. tnx..

please you use Windows Api

Private Declare Function MessageBoxTimeout Lib "user32.dll" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal uType As Long, _
ByVal wLanguageId As Long, _
ByVal dwMilliseconds As Long _
) As Long

Private Const IDYES& = 6&
Private Const IDNO& = 7&
Private Const MB_SETFOREGROUND& = &H10000
Private Const MB_YESNO& = &H4&
Private Const MB_ICONASTERISK& = &H40&
Private Const MB_TIMEDOUT& = &H7D00&

Private Sub Form_Load()
Dim lRet As Long
lRet = MessageBoxTimeout(0&, "your message", _
"Timeout MessageBox Test", MB_SETFOREGROUND Or MB_YESNO Or MB_ICONASTERISK, _
0&, 10000&)

Select Case lRet
Case IDYES:
'// your code
Case IDNO:
'// your code

Case MB_TIMEDOUT:
'// your code

End Select
End Sub


what version do you used? i used vb6..
Was This Post Helpful? 0
  • +
  • -

#8 khlee04  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 29-July 08

Re: msgbox with timer

Posted 29 July 2008 - 11:43 PM

View Postj0hnrAiner, on 29 Jul, 2008 - 11:02 PM, said:

View Postkhlee04, on 29 Jul, 2008 - 10:37 PM, said:

View Postj0hnrAiner, on 29 Jul, 2008 - 08:35 PM, said:

hi guys.. is it possible to make a msgbox box with timer? the user will need not to press the msgbox in order to execute the next line of the program.. i try this but i got wrong expected output..
msgbox timer1



help me guys pls.. tnx..

please you use Windows Api

Private Declare Function MessageBoxTimeout Lib "user32.dll" Alias "MessageBoxTimeoutA" ( _
ByVal hwnd As Long, _
ByVal lpText As String, _
ByVal lpCaption As String, _
ByVal uType As Long, _
ByVal wLanguageId As Long, _
ByVal dwMilliseconds As Long _
) As Long

Private Const IDYES& = 6&
Private Const IDNO& = 7&
Private Const MB_SETFOREGROUND& = &H10000
Private Const MB_YESNO& = &H4&
Private Const MB_ICONASTERISK& = &H40&
Private Const MB_TIMEDOUT& = &H7D00&

Private Sub Form_Load()
Dim lRet As Long
lRet = MessageBoxTimeout(0&, "your message", _
"Timeout MessageBox Test", MB_SETFOREGROUND Or MB_YESNO Or MB_ICONASTERISK, _
0&, 10000&)

Select Case lRet
Case IDYES:
'// your code
Case IDNO:
'// your code

Case MB_TIMEDOUT:
'// your code

End Select
End Sub


what version do you used? i used vb6..


me too ...i used vb6
Was This Post Helpful? 0
  • +
  • -

#9 j0hnrAiner  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 54
  • Joined: 24-July 07

Re: msgbox with timer

Posted 30 July 2008 - 06:16 PM

guys... pls check mycodes where i get wrong.. i got stuck up here in displaying the records in the database.. hope you cuold help me on this.. thanks..
Was This Post Helpful? 0
  • +
  • -

#10 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4308
  • View blog
  • Posts: 12,088
  • Joined: 18-April 07

Re: msgbox with timer

Posted 31 July 2008 - 10:29 PM

I assume DataReport2 is a form? I see you showing it but no where are you looping through your recordset and adding each record to some kind of control.

Are you completely stumped about this part and don't know where to start? Or are you having some issue with putting the data into a particular control? Be descriptive as to what you want to read and where you want the data to be shown.

Thanks. :)
Was This Post Helpful? 0
  • +
  • -

#11 j0hnrAiner  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 54
  • Joined: 24-July 07

Re: msgbox with timer

Posted 03 August 2008 - 07:22 PM

View PostMartyr2, on 31 Jul, 2008 - 10:29 PM, said:

I assume DataReport2 is a form? I see you showing it but no where are you looping through your recordset and adding each record to some kind of control.

Are you completely stumped about this part and don't know where to start? Or are you having some issue with putting the data into a particular control? Be descriptive as to what you want to read and where you want the data to be shown.

Thanks. :)



tnx for the reply.. i figure out already where i got wrong.. i forgot to close recordset everytime i terminate data report.. anyway.. tnx po..
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1