Welcome to Dream.In.Code
Getting VB Help is Easy!

Join 107,708 VB Programmers for FREE! Ask your question and get quick answers from experts. There are 1,100 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



DYNAMIC OBJECT REFERENCES IN FUNCTION

 
Reply to this topicStart new topic

DYNAMIC OBJECT REFERENCES IN FUNCTION, I WANT TO MAKE A REFERENCE TO AN OBJECT IN THE FORM WHOSE NAME IS FORM

PAPPULLY65
post 16 Jul, 2008 - 01:54 AM
Post #1


New D.I.C Head

*
Joined: 16 Jul, 2008
Posts: 1

CODE
Function FNDUPPER(MLEV As Integer) As Boolean
FNDUPPER = False
'MLEV = Len(CURCMD(Index).Name) - 6

For I = 0 To UBound(NOBJL)
    If NOBJL(I) > MLEV Then
       NLOBJ(I).Visible = False
       NOBJL(I) = -1
       FNDUPPER = FINDOBJECT("MCMD" & MLEV)
       Set NLOBJ(I) = Nothing
    End If
Next
End Function


Function FINDOBJECT(ByVal OBJNAME As Object) As Boolean
For J = 0 To OBJNAME.UBound
    If OBJNAME(J).Visible = False Then FINDOBJECT = False: Exit For
Next
End Function
User is offlineProfile CardPM

Go to the top of the page


PsychoCoder
post 18 Jul, 2008 - 12:35 PM
Post #2


DIC.Rules == true;

Group Icon
Joined: 26 Jul, 2007
Posts: 7,143



Thanked 50 times

Dream Kudos: 7700

Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, GDI

My Contributions


You you please post your question in the body of your post and not in the topic description. The description field holds a very limited number of characters. Also typing in all CAPS is considered yelling smile.gif
User is offlineProfile CardPM

Go to the top of the page

Ken Halter
post 23 Jul, 2008 - 06:23 PM
Post #3


New D.I.C Head

*
Joined: 18 Nov, 2007
Posts: 31



Thanked 4 times
My Contributions


Agreeing with PsychoCoder here... your question didn't make it thru and stop yelling! ;-)

But... and it's hard to tell going by the code you posted... there doesn't seem to be a need to know the name of the form.... not using the code you posted anyway (which can most likely be simplified)

If you repost the question, try and include more details, too... like... those arrays you're working with appear to be control arrays, but knowing that as a fact can make a big difference in the answer you end up getting.
User is offlineProfile CardPM

Go to the top of the page

kikz
post 23 Jul, 2008 - 07:18 PM
Post #4


New D.I.C Head

*
Joined: 21 Jul, 2008
Posts: 32



Thanked 1 times
My Contributions


A bit more information is needed to clearly answer your question. In lieu of that information I'll make a few guesses. wink2.gif

What sort of objects are you talking about? Controls on the form?
Do you mean COM objects?

What is NOBJL() an array of? It's not declared within your code snippet.


If you're looking for a control object on a form, you can interate through the form's control collection until you find a match on name
CODE

Function FindControl(frm as Form, sControlName as String) as Boolean
  FindControl = False

  Dim ctrl as Control
  For Each ctrl In frm.Controls
    If ctrl.Name = sControlName Then
      FindControl = True
      Exit For
    End If
  Next ctrl

End Function


(I think that will also iterate over the controls in container controls? If not, just do a bit of recursion inside the FindControl function.)

This post has been edited by kikz: 23 Jul, 2008 - 07:19 PM
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 8/30/08 03:04AM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month