Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Active form in Module 1

Status
Not open for further replies.

poltergeist

Programmer
Jul 16, 2003
173
CL
I'm a little confused today, so how I to know the active form object in a global module, In this moment i'm using ME like a parameter but it's not very good
 
That's just what Me is for!

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
You pass the form object to the procedure such as:

'Form Module
Private Sub Form_Load()
Center me
End Sub

'Global Module
Public Sub Center(frm As Form)
frm.Left = (Screen.Width - frm.Width) / 2
frm.Top = (Screen.Height - frm.Height) / 2
End Sub
 
Yes this I 'm properly doing, but I think their must be any option to verify the active form in the Global Code.
 
I suppose you could do something like:

Public Sub Center(frm As Form)
if frm.Name = "frmMain" then
frm.Left = (Screen.Width - frm.Width) / 2
frm.Top = (Screen.Height - frm.Height) / 2
end if
End Sub
 
Boy and girls

I'm doing this:
so it's good


Sub Jump(Key1 As Integer, Frm As Form)
Dim i, NewTabIndex As Integer
With Frm
Select Case Key1
Case 13
NewTabIndex = .ActiveControl.TabIndex + 1
Case 39
If .ActiveControl.SelStart = Len(.ActiveControl.text) Then _
NewTabIndex = .ActiveControl.TabIndex + 1 Else GoTo termino
Case 37
If .ActiveControl.SelStart = 0 Then _
NewTabIndex = .ActiveControl.TabIndex - 1 Else GoTo termino
Case Else
GoTo termino
End Select
If NewTabIndex = -1 Then
NewTabIndex = .Controls().Count - 1
ElseIf NewTabIndex = .Controls().Count Then
NewTabIndex = 0
End If
For i = 0 To .Controls().Count - 1
If .Controls(i).TabIndex = NewTabIndex Then Exit For
Next i
.Controls(i).SetFocus
termino:
End With
End Sub


thanks for your time
 
<off-topic>
I'm sure that you realise that:[tt]
Dim i, NewTabIndex As Integer[/tt]

has Dim'd i as a variant and NewTabIndex as an Integer

________________________________________________________________
If you want to get the best response to a question, please check out FAQ222-2244 first

'People who live in windowed environments shouldn't cast pointers.'
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top