Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Concatenating counter and object value
#1
Solved: 11 Years, 3 Months, 3 Weeks ago
In do while loop i want to concatenate txtFirstName with counter value like Kim1
Kim2
code im using for it:
Code:
counter = 1
Do
Browser("Softronic - HCMS").Page("Softronic - HCMS_2").WebList("ddlTitle").Select "Ms."
Fname = Browser("Softronic - HCMS").Page("Softronic - HCMS_2").WebEdit("txtFirstName").Set("Kim")
counterstr = CStr(counter)
Fname = Fname + counterstr
Loop while counter <= 5
counter = counter + 1
Fname shows only counter value i.e 1 , it is not showing Kim1 displays 1
Tell me what is wrong with the code?how can i concatenate
Reply
#2
Solved: 11 Years, 3 Months, 3 Weeks ago
Aru you sure Fname = Browser("Softronic - HCMS").Page("Softronic - HCMS_2").WebEdit("txtFirstName").Set("Kim") will return Kim. If Kim is the value which is always set in webedit box then when do use it dircetly like Fname = "Kim" + counterstr. if your need is get back the set value is better to use GetROProperty method.

Reply
#3
Solved: 11 Years, 3 Months, 3 Weeks ago
Hi,

The question that you are asking is not clear.

Let me rephrase your question. Do you want to set the values (such as Kim1,Kim2) in the txtFirstNameField? If yes then use the below code


Code:
counter = 1
Do
  Browser("Softronic - HCMS").Page("Softronic - HCMS_2").WebList("ddlTitle").Select "Ms."
  strVar=Cstr("Kim"&counter)
  Browser("Softronic - HCMS").Page("Softronic - HCMS_2").WebEdit("txtFirstName").Set strVar
  counter = counter + 1
Loop while counter <= 5
feel free to post in case this doesnt suits your requirement.

Regards,
Ankesh
Reply
#4
Solved: 11 Years, 3 Months, 3 Weeks ago
Yes exactly! thank u so much..This code fulfill my requirements.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
Rolleyes concatenating " (double quote) in a string??? vijayendra.shukla 3 18,995 07-05-2011, 08:06 PM
Last Post: rajpes

Forum Jump:


Users browsing this thread: 2 Guest(s)