This page demonstrate how we can add a simple button on the Form.

 

Adding Buttons

 

So far the window that we have created has nothing on it. And from the previous page we know that after a window has been created different controls can be added on it. Therefore in this page we show how we can add a button on the window we have just created. A Button control has many properties but the most basic ones are the Name and the Text that appears on a button.

 

The syntax below will create a button with some name and some text displayed on it.

<Button Name = S Text = S/> 

where S can be any string. Note that if Text attribute is not provided then the Name of the Button will be displayed on a button.

Example

 

The next example shows how a button can be added on the window.

 

Example 2.2.1: Source

 

 below we have provided the code that is responsible for generating the image above.

@"<Form Text= 'Views Tutorial'>
    <Button Name = 'b1' Text = 'MyFirst'   Button/>
 </Form>";

 

<<PREVIOUS  NEXT >>