1. Does anyone have the code for centering forms on screens with different resolutions?
2. I could still use some help on scrolling code as well
http://<br /> <a rel="nofollow" hre...4942</a><br />
Flint
1. Does anyone have the code for centering forms on screens with different resolutions?
2. I could still use some help on scrolling code as well
http://<br /> <a rel="nofollow" hre...4942</a><br />
Flint
formabc.Top = (Screen.Height - Me.Height) / 2
formabc.Left = (Screen.Width - Me.Width) / 2
Hope it help
I thought in VB6 and above have a property which u can set the start location of the window. I can't remember the property.
I would check for u but I'm at school <:).
-Justin
me.StartupPosition = 2
I use a module with the following subroutine
and in my Form_Load subroutine I have the lineCode:Public Sub Center(frmMe As Form)
' center the form
frmMe.Top = (Screen.Height - frmMe.Height) / 2
frmMe.Left = (Screen.Width - frmMe.Width) / 2
End Sub
BTW, dragonyian, your answer is true only when formabc and Me are the same form.Code:Center Me
Ya, i saw it when i posted it.. i think that will work... by the way, can anypone help me with this
y = 0.01
do while y <1
y = y*10
loop
text1.text = y
i wonder why the answer is 9.99 but not 1
Are you using a floating point for y?
That would cause someoperations to get inexact...
now why don't you keep this on this thread
http://forums.vb-world.net/showthrea...threadid=35076
Thanx ccoder. That's what I was lookin for!
I will try your suggestion nitro.
Dragonyian: The
does not allow the y varible to become 1. Your code continues to multiply y(0.01) * 10 until the value of y = .99Code:do while y <1
take .99 * 10 and you get 9.99
hope this helps
Flint
Quote:
A man will pay $2 for a $1 item he wants. A woman will pay $1 for a $2 item that she doesn't want.
I like ccoder's code, but using the move method lets you take care of top, left, width, and height all in one call.
Using a With statement saves a little processing time.
Dragonian, try this insteadCode:Public Sub CenterForm(frmIn As Form)
' Purpose: Centers form on screen
' Usage: CenterForm(Me)
' Note: Usually put in Form_Load or Form_Activate events
With frmIn
.Move (Screen.Width - .Width) / 2, (Screen.Height - .Height) / 2
End With
End Sub
Hope that helps!Code:y = 0.01
Do While y <= 1
y = y * 10
Loop
text1.Text = y
Thank you seaweed. (Somehow I never thought I'd say that...lol)
I will certainly give your code a go.
Of course, I expect my code to be running on a minimum of PII 300mhz or better.
Hmmmm....I wonder If I need to include any ocx files in the installation because the app will primarily be used on laptops. Trial and Error shall tell.
Flint
Quote:
Experience is often what you get when you were
expecting something else.