Jump to content
klaudy

[importante] nao verificar 2 vezes a função getcontrolfullname

Recommended Posts

klaudy

ola

eu tenho o seguinte codigo

Private sub BuildStylersList()
stylers =new  List (of Istyle)
styledControls = new List (Of String)
dim assembly = reflection.Assembly.getExecutingAssembly
dim sb=new system.text.stringbuilder

for each t in assembly.getType
if implementsIStyle(t)
dim obj =activator.createInstance(t)
dim sty = ctype(obj, Istyle)

stylers.Add(sty)
End if
next 
End sub

Public sup Applystyle(byval theform as control)
if stylers Is nothing then BuildStylesList()
dim fullname = getControlFullName(theForm)
if styledControls.contains(fullName) then Exit sub
For each c AS control In theform.controls
if c.HasChilden then Applystyle(c)
For each s in stylers
s.ApplyStyle(c)
Next
Next
Styledcontrols.Add(fullName)
End sub 

Private Function GetContolFullname(Byval c as Control) AS string

...

end function

Private Function ImplementStyle(byval objectType AS Type) As Boolean
dim int = getType(Istyle)
for each thisInterface AS type In ObjectType.GetInterfaces 
If thisInterface Is int Then _
Return true 
Next
End Fucntion


o que eu queria saber era como coloco um ciclo na função GetContolFullname, para que não verique 2 vezes o mesmo fullname.

Assim, se quiser actulizar, este não ira permitir.

obrigado

Share this post


Link to post
Share on other sites
herty

guardas num array os nomes que ja verificas.t e so fazes o ciclo caso nao exista.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.