Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
315
Swftable: Object Reference not set to a Instance
posted

Hello All,

QTP Version : 9.2
Add -ins - .Net,WPF, Infragistics TestAdvantage

While working with a SWftable, for the first time it executes without a issue while the same code in the action repeated throws the error "Object REference not set to a instance". Here is the code,

rows=Browser("BRW").Window("Win").swftable("tbl").object.rows

for r=0 to rows-1

  user_val=Browser("BRW").window("win").swftable("tbl").getcelldata(Cint(r),"EntryName")
Next

It throws the error when it reaches user_val. Is there a alternative for getcelldata ?? IF i can use the object properties to retrieve the cell data it would be wonderful.

I tried swftable().object.rows(1).cells(0).value and it did not work.

Can anyone please take a look at it ??

 Warm Regards,

Robert

Parents
No Data
Reply
  • 6729
    Offline posted

    Hi Rebert, 

    I noticed that you are using ".Object.Rows" you should use ".Object.Rows.Count" instead

    If that did not work you can try the GetNAProperty here how to do it:

    rows=Browser("BRW").Window("Win").swftable("tbl").GetNAProperty("Rows.Count")

    for r=0 to rows-1

      Cell_val=Browser("BRW").window("win").swftable("tbl").GetNAProperty("Rows["+CSTR(r)+"].Cells[EntryName].Value")

      Cell_Text=Browser("BRW").window("win").swftable("tbl").GetNAProperty("Rows["+CSTR(r)+"].Cells[EntryName].Text")

    Next

    I hope that will help,

    Regards,

    Ammar

Children