Accesing control property via string

Hi

I have tried to create a .Net method which I could call from ScreenMaker application. The method should change the index of the tab control which is created in ScreenMaker. The idea is to change the tab automatically when user has clicked a button in current tab. I tried to find how to access the control property via string, so I could just pass the name of the tabControl to .Net method as a string parameter.

I found some help from google and tried to test it in normal FP SDK application before trying to implement that in SM. The example said that this syntax below should do the trick, but I’m only receiving two error messages when building the application.

this.Controls[“tabControl1”].SelectedIndex = 2;

Error 1 The best overloaded method match for ‘System.Windows.Forms.Control.ControlCollection.this[int]’ has some invalid arguments

Error 2 Argument ‘1’: cannot convert from ‘string’ to ‘int’

Does anyone know what I’m doing wrong? Or is there any other way to access controls made in ScreenMaker?

-Osku

Hi,

The property which takes a string as parameter is noy available in the Compact Framework, only in the Full Framework.

http://msdn.microsoft.com/en-US/library/system.windows.forms.control.controlcollection.item(v=VS.85).aspx

What you could do is iterate thoruch the control list to find for the Tab Control (this could work as long as there is only one tab control)

BR

Hi,
I am also searching for this kind a information. If any one have any suggestion please share and help us.

Thanks!


Thanks Carlos, I’ll try that!

-Osku