Member Avatar for kohkohkoh

I saw there is some code in C# where

it can do copy and paste
and also does the automation typing in a textbox or file..
(not using fieldname.text = "value" )
it seems using some system.window.input.

you guys got the link or resources?

your kindness is very much appreciated!
thank you!

Recommended Answers

All 10 Replies

Sorry, I'm not quite following your problem. Can you maybe provide some more information?

Member Avatar for kohkohkoh

Hi,
I'm sorry for my unclear explanation.

Actually, I have a webbrowser control in my application.
i found some event/coding that the application will auto click the button in the webbrowser. (without user to click the button).
but i lost the site, so i dont have any resources....

do you get the picture?

Use the button.PerformClick() method (fill in the name of your control for button).

Member Avatar for kohkohkoh

But i want to click the button which is in the web control.
thanks

That button is still a valid button. When I put a web browser on my form there's nothing on there with it, the button must have been added along the way. Right click it and check the properties to see what the name is. Then to have your code activate it, run mybuttonname.PerformClick().

Check the link adatapost gave you. I used the same technique recently to automate data input to a website.
The trick (as mentioned in the comments of the code in the link) is to view the source of the page and locate the controls you wish to interact with. Once you know the ID they are assigned by the website owner you can interact with them by ID.

You will need to include the COM reference to 'Microsoft HTML Object Library' in your project references.

Judging from the other replies I bet I misjudged what the OP wanted. Apologies.

Judging from the other replies I bet I misjudged what the OP wanted. Apologies.

Slightly, but you were still right. He wants to programattically populate fields or click buttons on a page in a webbrowser control.
He does need to use .PerformClick() but he needs to get a handle on the control in the webbrowser first.

Member Avatar for kohkohkoh

Thank guys.
I've tried to use .PerformClick()
it works perfectly....
and i found another way which using
SendKeys.Send(<action>).

:)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.