Here are some Regular expressions for html parsing .
You can use it in your application while parsing html table to fetch data from it
1. Table Expression = “<table[^>]*>(.*?)</table>”
2. Header Expression = “<th[^>]*>(.*?)</th>”
3. Row Expression = “<tr[^>]*>(.*?)</tr>”
4. Column Expression = “<td[^>]*>(.*?)</td>”
Wednesday, September 24, 2008
Friday, September 12, 2008
Web Browser Control
Web Browser Control is a Handy Component , which can be used for website navigation, data extraction, navigation event handling, event overriding, etc,... This component is available in windows application of .Net
To Specify the Default Url, to be loaded when the web browser is loaded, the Url propety is set in the properties. For the page to be blank specify about:blank in the Url property
Some websites will have same ignorable script errors which will pop up as
an error during navigation , which can be avoided using ScriptErrorsSupressed Property and Scroll bars can be enabled using ScrollBarsEnabled Property
Major Event and Methods of Web Browser :
1. Public Sub Navigate(ByVal urlString As String)
Summary:
Loads the document at the specified Uniform Resource Locator (URL) into the System.Windows.Forms.WebBrowser control, replacing the previous document.
Loads the document at the specified Uniform Resource Locator (URL) into the System.Windows.Forms.WebBrowser control, replacing the previous document.
2. Public Function GoForward() As Boolean
Summary:
Navigates the System.Windows.Forms.WebBrowser control to the next page in the navigation history, if one is available.
Navigates the System.Windows.Forms.WebBrowser control to the next page in the navigation history, if one is available.
3. Public Function GoBack() As Boolean
Summary:
Summary:
Navigates the System.Windows.Forms.WebBrowser control to the previous page in the navigation history, if one is available.
4. Public Overrides Sub Refresh()
Summary:
Reloads the document currently displayed in the System.Windows.Forms.WebBrowser control by checking the server for an updated version.
Reloads the document currently displayed in the System.Windows.Forms.WebBrowser control by checking the server for an updated version.
5. Public Sub [Stop]()
Summary:
Cancels any pending navigation and stops any dynamic page elements, such as background sounds and animations.
Cancels any pending navigation and stops any dynamic page elements, such as background sounds and animations.
Sunday, August 17, 2008
How to Simulate Keyboard
Have you wondered , How to Simulate a Keyboard through .net application...
You can programatically simulate a keyboard , Which make the user viewing feel that as if you are typing sitting in front of the PC..
You can send keys one by one to the system which pretends that user is typing the keys one by one....
This is very simple.... You can just use one function for this which simulates the keyboard funtionality..
sendkeys.send(key)
The key may be a string, character or a special function key of the keyboard
This types the key you have sent on the screen wherever the focus is...
The different possible values for key are :
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER}or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC} (reserved for future use)
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Keypad add {ADD}
Keypad subtract {SUBTRACT}
Keypad multiply {MULTIPLY}
Keypad divide {DIVIDE}
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes.
Key Code
SHIFT +
CTRL ^
ALT %
To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".
To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.
Note Because there is no managed method to activate another application, you can either use this class within the current application or use native Windows methods, such as FindWindow and SetForegroundWindow, to force focus on other applications.
Example[Visual Basic, C#] The following code example demonstrates how to use the Send method. To run the example, paste the following code in a form called Form1 containing a button called Button1. The button control's TabIndex property should be set to 0. When the example is running, double-click the form to trigger the button's click event. Ensure the events are connected to their event-handling methods.[Visual Basic]
------------------------------------------------------------------------------------
' Clicking Button1 causes a message box to appear.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Click here!")
End Sub
' Use the SendKeys.Send method to trigger the Button1 click event
' and display the message box.
Private Sub Form1_DoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.DoubleClick
' Send the enter key; since the tab stop of Button1 is 0, this
' will trigger the click event.
SendKeys.Send("{ENTER}")
End Sub
------------------------------------------------------------------------------------
You can programatically simulate a keyboard , Which make the user viewing feel that as if you are typing sitting in front of the PC..
You can send keys one by one to the system which pretends that user is typing the keys one by one....
This is very simple.... You can just use one function for this which simulates the keyboard funtionality..
sendkeys.send(key)
The key may be a string, character or a special function key of the keyboard
This types the key you have sent on the screen wherever the focus is...
The different possible values for key are :
BACKSPACE {BACKSPACE}, {BS}, or {BKSP}
BREAK {BREAK}
CAPS LOCK {CAPSLOCK}
DEL or DELETE {DELETE} or {DEL}
DOWN ARROW {DOWN}
END {END}
ENTER {ENTER}or ~
ESC {ESC}
HELP {HELP}
HOME {HOME}
INS or INSERT {INSERT} or {INS}
LEFT ARROW {LEFT}
NUM LOCK {NUMLOCK}
PAGE DOWN {PGDN}
PAGE UP {PGUP}
PRINT SCREEN {PRTSC} (reserved for future use)
RIGHT ARROW {RIGHT}
SCROLL LOCK {SCROLLLOCK}
TAB {TAB}
UP ARROW {UP}
F1 {F1}
F2 {F2}
F3 {F3}
F4 {F4}
F5 {F5}
F6 {F6}
F7 {F7}
F8 {F8}
F9 {F9}
F10 {F10}
F11 {F11}
F12 {F12}
F13 {F13}
F14 {F14}
F15 {F15}
F16 {F16}
Keypad add {ADD}
Keypad subtract {SUBTRACT}
Keypad multiply {MULTIPLY}
Keypad divide {DIVIDE}
To specify keys combined with any combination of the SHIFT, CTRL, and ALT keys, precede the key code with one or more of the following codes.
Key Code
SHIFT +
CTRL ^
ALT %
To specify that any combination of SHIFT, CTRL, and ALT should be held down while several other keys are pressed, enclose the code for those keys in parentheses. For example, to specify to hold down SHIFT while E and C are pressed, use "+(EC)". To specify to hold down SHIFT while E is pressed, followed by C without SHIFT, use "+EC".
To specify repeating keys, use the form {key number}. You must put a space between key and number. For example, {LEFT 42} means press the LEFT ARROW key 42 times; {h 10} means press H 10 times.
Note Because there is no managed method to activate another application, you can either use this class within the current application or use native Windows methods, such as FindWindow and SetForegroundWindow, to force focus on other applications.
Example[Visual Basic, C#] The following code example demonstrates how to use the Send method. To run the example, paste the following code in a form called Form1 containing a button called Button1. The button control's TabIndex property should be set to 0. When the example is running, double-click the form to trigger the button's click event. Ensure the events are connected to their event-handling methods.[Visual Basic]
------------------------------------------------------------------------------------
' Clicking Button1 causes a message box to appear.
Private Sub Button1_Click(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles Button1.Click
MessageBox.Show("Click here!")
End Sub
' Use the SendKeys.Send method to trigger the Button1 click event
' and display the message box.
Private Sub Form1_DoubleClick(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.DoubleClick
' Send the enter key; since the tab stop of Button1 is 0, this
' will trigger the click event.
SendKeys.Send("{ENTER}")
End Sub
------------------------------------------------------------------------------------
Subscribe to:
Posts (Atom)


