Need to find Datagrid without giving the ControlName

Ask general questions here.
palanikumar.m
Posts: 8
Joined: Mon May 19, 2008 2:35 pm

Need to find Datagrid without giving the ControlName

Post by palanikumar.m » Tue May 20, 2008 11:44 am

I need to find one DataGrid from Form. But i dont know the ControlName. Because RanorexSpy didnt give the ControlName. it gives the Classname and controlID only.

Now, how i find the DataGrid?

Plz, help for this problem!!!!!!!

Thanks & Regards,
Palani

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue May 20, 2008 1:39 pm

The Control Id is usually sufficient to uniquely identify a control (unless it's a .NET control which have dynamic control ids). Just use one of the Control.Find... methods (e.g. FindControlId or FindButton(Int32 controlId)) to search for the datagrid.

Perhaps it's a good idea to read the Ranorex User Guide, especially the Quick Start page!

Regards,
Alex
Ranorex Support Team

palanikumar.m
Posts: 8
Joined: Mon May 19, 2008 2:35 pm

Need to find Datagrid without giving the ControlName

Post by palanikumar.m » Tue May 20, 2008 3:13 pm

DataGrid dataGrid = form.FindDataGrid("dataGridView1");
// Reading colum text of column 1
String columnText = dataGrid.GetColumnText(1);
Console.WriteLine("DataGrid ColCount = {0} ", dataGrid.ColumnCount);

instead of above suppose, if i am using,

DataGrid dataGrid = form.FindControlId("...");

(or)

DataGrid dataGrid = form.FindClassName("...");

It asking the cast converter, What i need to give for cast conversion?

Thanks & regards,
Palani

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Tue May 20, 2008 4:43 pm

The FindControlId method returns a Control instance even if the found control is indeed a datagrid. However, if you know that the returned control is a datagrid, you can construct a DataGrid object in the following way:

Code: Select all

Control dataGridControl = form.FindControlId(1234);
DataGrid dataGrid = new DataGrid(dataGridControl.Handle);
Regards,
Alex
Ranorex Support Team

palanikumar.m
Posts: 8
Joined: Mon May 19, 2008 2:35 pm

got exception when using datagrid

Post by palanikumar.m » Wed May 21, 2008 9:11 am

Hi Alex,

I have inserted code, what you have suggested me.

But i got exception in a form.FindControlId and dataGridControl.Handle

I got the below exception :

"Function evaluation disabled because a previous function evaluation timed out............."

I feel very hard to describe all those things.

Could you plz, call my number. Or, can you give me your contact number?

Because, Now i am evaluating the testing tools for select one.

if problem solved, my company will purchase this tool.

My contact details :

M.Palanikumar,
Mobile : +91 9941239091
Off : +91 44 67422312

User avatar
Support Team
Site Admin
Site Admin
Posts: 11709
Joined: Fri Jul 07, 2006 4:30 pm
Location: Graz, Austria

Post by Support Team » Mon May 26, 2008 2:50 pm

I only know this kind of error message ("Function evaluation disabled because a previous function evaluation timed out") from the Visual Studio debugger when you are stepping through code slowly. Please, try to set a breakpoint at the exact point in the code that you want to inspect!
palanikumar.m wrote:Could you plz, call my number. Or, can you give me your contact number?
I am sorry, but at the moment we do not provide telephone support. You can, however, contact us via email at support_at_ranorex.com.

Regards,
Alex
Ranorex Support Team