PDA

View Full Version : [CLOSED] Question about MyDesktop.Modules



feanor91
Sep 19, 2013, 1:35 PM
Hello

I tried to translate code from VB to C# and I stuck on a problem.

I want to get first window from a desktop modules. In VB I wrote :



myWindow = MyDesktop.Modules("wntTest").Window(0)


In C# I have an error saying that :
member could not be called and can't be used as a method (aproximately translate from french to english)


Ext.Net.Window myWindow = MyDesktop.Modules("wntTest").Window(0);


The goal is to add controls to the window.

So how can I achive that?

Edit...

Hum, think I have found:


Ext.Net.Window myWindow = (Ext.Net.Window)MyDesktop.Modules[0].Window[0];


Correct?

Daniil
Sep 19, 2013, 2:36 PM
Hi @feanor91,

Yes, that is correct - indexing in C# is done via square brackets.

This also should work.

MyDesktop.Modules["wntTest"].Window[0];

feanor91
Sep 19, 2013, 3:13 PM
Yes, shame on me, I just begining to read book to learn C#...

Meanwhile, is there a way to have something to have an acces to modules like in VB because how to now Module(i) is module I need if I have 20 of them, for example? I have to tuen in a foreach loop to seek Module'name?

Daniil
Sep 19, 2013, 4:06 PM
Seems, I already posted what you need. Am I misunderstanding something?



This also should work.

MyDesktop.Modules["wntTest"].Window[0];

feanor91
Sep 19, 2013, 4:50 PM
Oh, yes, very sorry, I read and answer quicly before quiting my job. Too quickly obviously.

Thanks