943,749 Members | Top Members by Rank

Ad:
Mar 7th, 2009
0

help

Expand Post »
it is possible? if the user in the running time, click the close button or the X button that we can see in the top of the form and then if the user click the close or X button message box will appear "you cannot log out"? how can i do this? thanks. .
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Mar 7th, 2009
0

Re: help

why not set the "borderstyle" properties of the form to "0-None" so the form will not display "X" the user will not be able to terminate your program unless user choose to close the program using "task manager"
Reputation Points: 19
Solved Threads: 115
Nearly a Posting Virtuoso
cguan_77 is offline Offline
1,317 posts
since Apr 2007
Mar 7th, 2009
0

Re: help

Click to Expand / Collapse  Quote originally posted by ryan311 ...
it is possible? if the user in the running time, click the close button or the X button that we can see in the top of the form and then if the user click the close or X button message box will appear "you cannot log out"? how can i do this? thanks. .
yes this is possible

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Private Sub Form_Unload(Cancel As Integer)
  2. Cancel = True 'set to any none zero number could be cancel=1
  3. MsgBox "Running, cannot close form now!"
  4. End Sub
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009
Mar 7th, 2009
0

Re: help

hi thanks for your code but i have a problem

Visual Basic 4 / 5 / 6 Syntax (Toggle Plain Text)
  1. Set rs = New ADODB.Recordset
  2. rs.Open "Select * from temp", cn, adOpenKeyset, adLockPessimistic
  3. If Val(rs!quantity) = Null Then
  4. calcel = False
  5. Unload Me
  6. Else
  7. cancel = True
  8. MsgBox "You Must Purchase it First, Before Log out", vbInformation
  9. lvButtons_H3.SetFocus
  10. End If
either bof or eof is true? that is the error. .
Reputation Points: 3
Solved Threads: 5
Posting Whiz in Training
ryan311 is offline Offline
254 posts
since Jul 2008
Mar 7th, 2009
0

Re: help

Well that is an entirely different animal. Try adding an if statement to check for the existance of a valid recordset...
If rs.BOF = False AND rs.EOF = False AND rs.RowCount <> 0 Then
  'we have a valid recordset with at least one record
End If
Last edited by vb5prgrmr; Mar 7th, 2009 at 12:21 pm.
Reputation Points: 156
Solved Threads: 296
Posting Virtuoso
vb5prgrmr is offline Offline
1,670 posts
since Mar 2009

This thread is solved

Either the thread starter or a moderator has marked this thread as solved. You can most likely trust the responses and answers given. There is most likely no reason for any further responses to be posted here. If you have a related question, please start a new thread in this forum instead.

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Textbox: On Copy... (VBA in AC2003)
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: how to load a data in mshflexgrid using textmatrix?





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC