Check Control's property name exist or name

H

Hardik Shah

Hi,

I have created a form , and have a different controls on them. I want to
check that control has particular property name or not.

I wrote following code , tell me what I missing :-
Dim ctl As Control

For Each ctl In Me.ParentForm.Controls

' IsPropery(ctl.

Next

Thanks in advance.

Hardik Shah
 
H

Herfried K. Wagner [MVP]

Hardik Shah said:
I have created a form , and have a different controls on them. I want to
check that control has particular property name or not.

I wrote following code , tell me what I missing :-
Dim ctl As Control

For Each ctl In Me.ParentForm.Controls

' IsPropery(ctl.

Next

\\\
Imports System.Reflection
..
..
..
.... = ctr.GetType().GetProperty(...)
///
 
H

Hardik Shah

Hi,

Thanks for your previous reply.

I have a form that have controls . some of them have EnableMode property. I
want to do process to that control and want to know its value. I wrote
following commands, pl. tell what I am missing.


Dim ctl As Control
Dim str As String

For Each ctl In Me.Controls

MessageBox.Show (ctl.GetType.GetProperty("EnableMode")...)

Next


Thanks in advance.


Hardik.
 
K

Kalpesh

Hardik,

If you know the type of the control, you dont need Reflection
I suppose this is applicable to winform control, which you created

so
dim typename as string
for each ctrl in Me.Controls
typename = TypeName(ctrl)
if typename = "mycommandbutton" then
msgbox ctrl.EnabledMode
end if
next

Please excuse my vb.net syntax
Does this help ?

Kalpesh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top