Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Concatenating counter and object value
02-21-2012, 10:19 AM
Post: #1
Concatenating counter and object value

In do while loop i want to concatenate txtFirstName with counter value like Kim1
Kim2
code im using for it:
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
Find all posts by this user
Quote this message in a reply
02-21-2012, 10:44 AM
Post: #2
RE: Concatenating counter and object value
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.
Find all posts by this user
Quote this message in a reply
02-21-2012, 11:11 AM
Post: #3
RE: Concatenating counter and object value
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


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
Find all posts by this user
Quote this message in a reply
02-21-2012, 11:41 AM
Post: #4
RE: Concatenating counter and object value
Yes exactly! thank u so much..This code fulfill my requirements.
Find all posts by this user
Quote this message in a reply
Post Reply 


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

Forum Jump:


User(s) browsing this thread: 1 Guest(s)