Forum Discussion

drawdon's avatar
13 years ago

Testcomplete 9 testing a .net application - Q uestion on maskedtextbox and data driven testing

I recorded datafields like Phone Number, Social Security Number, etc., but when I execute Data Driven Tests via Excel, I am having problems.



For Example.



I have a phone number I would like to pull from Excel and place it in the Phone 1 field.  It appears to store it in the maskedtextbox field, but after a "SAVE", the old value is still present.



Here is some code.





Set frmMainTree = Aliases.CwuMain.frmMainTree


Set panel = frmMainTree.panel1


Set treeView = panel.trvMain


Set mdiClient = frmMainTree.MdiClient


Set frmClientSetup = mdiClient.frmClientSetup1


Set tabControl = frmClientSetup.tabClientMain


Set tabPage = tabControl.tabClientContact


Set groupBox = tabPage.gbxClientContact






Set maskedTextBox = groupBox.mtbxClientPhn1    'CLIENT PHONE NUMER


Call maskedTextBox.SetText("(___) ___-____")    'CLEARS OUT THE FIELD ON THE SCREEN


Call maskedTextBox.SetText(Edit_Client_Contact_Info_Driver.Value(15))     'SET THE TEXT WITH EXCEL DATA


Call maskedTextBox.Keys("[Tab]")     'TAB TO THE NEXT FIELD


END OF CODE



Text for Phone 1 is not really set, it just looks that way, but .Net program does not think anything has changed.



What am I not doing with this maskedtextbox to get it to work?





Excel Data is in this form   "(828) 334-9897"       I tried the cell as phone number or just text, same result.



Need help.



Doug







  • Hi Doug



    Try changing the SetText command to Keys. The fields in your application may be not recognize that the text has changed based on SetText, but Keys types into a field exactly as an end user would.



    Cheers

    Nick
  • Anonymous's avatar
    Anonymous

    Nick, great to see you on our Forums. Don't you want to share your connection to SmartBear? :)



    Doug, from the Support team (you've contacted them, as well) I found out that you solved the problem, but didn't mention the way you used. Could you please share it with us? Was it the Keys method?