Important alert: (current site time 7/16/2013 12:49:30 AM EDT)
 

VB icon

[ Center Forms Without Errors When Maximized ]

Email
Submitted on: 8/27/2003 6:19:14 AM
By: JamesJD  
Level: Beginner
User Rating: By 2 Users
Compatibility: VB 3.0, VB 4.0 (16-bit), VB 4.0 (32-bit), VB 5.0, VB 6.0
Views: 26167
author picture
(About the author)
 
     This will center forms and when you maximize the form the Command Button which you click to re-center it will be disabled.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.
				
'**************************************
' Name: [ Center Forms Without Errors When Maximized ]
' Description:This will center forms and when you maximize the form the Command Button which you click to re-center it will be disabled.
' By: JamesJD
'
' Inputs:You will need: One Command Button (you just need to keep there default names)
'
'This code is copyrighted and has' limited warranties.Please see http://www.Planet-Source-Code.com/vb/scripts/ShowCode.asp?txtCodeId=48023&lngWId=1'for details.'**************************************

Private Sub Command1_Click()
If Form1.WindowState = 0 Then
Form1.Left = Screen.Width / 2 - Form1.Width / 2
Form1.Top = Screen.Height / 2 - Form1.Height / 2
Else
Command1.Enabled = False
End If
End Sub
Private Sub Form_Load()
Form1.Left = Screen.Width / 2 - Form1.Width / 2
Form1.Top = Screen.Height / 2 - Form1.Height / 2
End Sub
Private Sub Form_Resize()
If Form1.WindowState = 2 Then
Command1.Enabled = False
Else
Command1.Enabled = True
End If
End Sub


Other 21 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

2/22/2004 5:22:42 PM

Hi, i need some urgent help with some codes, required for a menu system. If you're able top help me out, i'd appreciate that, and if you can help me oput with the codes, could you pls kindly email me at haripreetsingh@hotmail.com, and i'll email back to you, the kind of codes i need.
Thanks
Hari
(If this comment was disrespectful, please report it.)

 
4/18/2004 1:17:45 AM

Hi..I am currently working on my university final year project.My task is to create a database management system for courier services.I would like to know how do I make use of the "Count" command for eg I want to calculate how many packages have been delivered today? I know that I can do this by counting the rows where the same ID appears everytime.I'd be grateful if u can just show me some sample codes for this task?Thanks a lot!
(If this comment was disrespectful, please report it.)

 
4/18/2004 7:14:07 AMJamesJD

Sorry, I'm having problems too with my database project...
(If this comment was disrespectful, please report it.)

 
10/25/2004 6:16:49 AM

ok
(If this comment was disrespectful, please report it.)

 
2/23/2006 7:37:49 PMZack

u can use query
select count(*) from [tablename] where [field date]=[date value]

or if you already have it in a adodb.recordset u can do [recordset name].recordcount
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.