Quick test professional

QTP Tips QTP codes QTP Faqs and more

Prompt Dialog For Password Entry In QTP with help of DotNetFactory

The following code popup a dialog with a edit box for a password entry when it run from the QTP

Set objForm = DotNetFactory.CreateInstance(“System.Windows.Forms.Form”, “System.Windows.Forms”)
Set objBtn1 = DotNetFactory.CreateInstance(“System.Windows.Forms.Button”, “System.Windows.Forms”)
Set objEdit1 = DotNetFactory.CreateInstance(“System.Windows.Forms.TextBox”, “System.Windows.Forms”)
Set p1 = DotNetFactory.CreateInstance(“System.Drawing.Point”,”System.Drawing”,x,y) ‘This will provide the locations(X,Y) for the controls
Set lbl= DotNetFactory.CreateInstance(“System.Windows.Forms.Label”,”System.Windows.Forms”)
lbl.Text=”Enter Password”

objEdit1.UseSystemPasswordChar=true’To set the password character From system





objForm.Text=”Mohan kakarla”

msgbox “The Password You have Entered Is: “&objEdit1.Text

Author: Mohan Kumar Kakarla


March 15, 2008 - Posted by | DotNetFactory, Uncategorized | , , ,


  1. hai
    Plz any one can give QTP Full tutorial on 9.5
    Thanks and Regards

    Comment by Prasad | June 23, 2008 | Reply

  2. Prasad,
    If you have the 9.5 installed , you can find very good help file there only. else download evaluation verson and find the help file

    Comment by quicktestprofessional | June 23, 2008 | Reply

  3. Hello,

    My requirement is to create a Form with multiple edit boxes and radio buttons using QTP 9.5. Where can i get a full list of all the objects and their properties, that i can create using DotNetFactory.

    Thanks and Regards,

    Comment by Siva | July 16, 2008 | Reply

  4. So far there is no good material on DotNetFactory. what u can do id goto msdn http://msdn.microsoft.com/en-us/library/system.windows.forms.aspx

    and look for the required object(edit box ,radio etc) read the example and understand how it works , then use ur dotnetfactory knowledge to write code.

    Mohan Kumar kakarla

    Comment by quicktestprofessional | July 17, 2008 | Reply

  5. Hello Mohan,

    Thank you for the reply. I have checked the link provided by you and will try to use the same.

    Thanks and Regards,

    Comment by Siva | July 17, 2008 | Reply

  6. Hi,

    Its good to see u r posts.But i do have a an idea calling a function,so that write instructions to dynamically attach object repository and perform necessary operations and de-attach the object repository and end the function.

    Is there any procedure to implement this idea.

    Comment by cse146179 | December 5, 2008 | Reply

  7. Hi,

    I need to design QTP framework in my organization
    Kindly Help me. What factors should taken care about for that.

    thank in advance

    Comment by Nirmal Kumar | December 6, 2008 | Reply

  8. Nirmal Kumar,

    1. find the Reusability factor and design the components

    2. create shraed OR

    3. Test data

    4. Flow of the TC

    5. Driver script,recovery scenarios etc

    Comment by quicktestprofessional | December 8, 2008 | Reply

  9. Hi,

    I wrote the similar code as above to get the user id / password and save it to excel sheet.

    But my problem is after executing the code, the pop up dialog is not displayed on the top of all screens but instead it is behind all the windows.

    can you tell me what command it have to use to bring it to front?


    Comment by CoolGuy | April 10, 2009 | Reply

  10. Hi,
    I got a requirement like to check the date on the left side of the page
    Date is like:Monday,26 Oct 2009 12:40 PM

    And the time is in IST

    Please clarify,

    Thanks in advance,
    Raghavender Gujjala

    Comment by raghavender | October 27, 2009 | Reply

  11. Hi all,

    I am going to work on Dotnet Factory in QTP…and i am new to this…if any one have tutorial/manuals/sample scripts could you please share with me..?

    Comment by Ramakrishna | August 6, 2010 | Reply

  12. how to set charecter lengh fixed in the text box ?

    Comment by Supra | April 19, 2012 | Reply

  13. Thanks a lot Mohan. This is something which i was looking for.

    Comment by Manju | December 14, 2012 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: