Ask a Question

convert a jtable cell to a string

SOLVED
chrislukasik
Contributor

convert a jtable cell to a string

this works to print a cell from a jtable

 

for (Col=0; Col<Grid["wColumnCount"]; Col++)
    Log["Message"]("Cell (0, " + Col + ") value: " + Grid["wValue"](0, Col));

 

the question is:   how do i convert a grid celll to a string in c# ?

3 REPLIES 3
Marsha_R
Community Hero

wValue is already a string 


Marsha_R
[Community Hero]
____
[Community Heroes] are not employed by SmartBear Software but
are just volunteers who have some experience with the tools by SmartBear Software
and a desire to help others. Posts made by [Community Heroes]
may differ from the official policies of SmartBear Software and should be treated
as the own private opinion of their authors and under no circumstances as an
official answer from SmartBear Software.
The [Community Hero] signature is used with permission by SmartBear Software.
https://community.smartbear.com/t5/custom/page/page-id/hall-of-fame
chrislukasik
Contributor

if I attempt this

 

string id = Grid["wValue"](0, 1);

 

I get

 

System.InvalidCastException: Unable to cast COM object of type 'System.__ComObject' to class type 'System.String'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.
at AutomatedQA.script.var.op_Implicit(var arg)

This worked

 

jtables[0]["wValue"](0, 1)["ToString"]()["OleValue"]

cancel
Showing results for 
Search instead for 
Did you mean: