It is included with Office 2007 and is also part of the Visual Studio 2005 SDK.Access to a system running Visual Studio with C# support is a pre-requisite for this tutorial. VSTA 1.0 was released to manufacturing along with Office 2007. Microsoft also announced Visual Studio Tools for Applications as the successor to Visual Basic for Applications (VBA) and VSA (Visual Studio for Applications).At the bottom of the window is a field for providing a project name. For the purposes of this tutorial we will be developing a Windows Forms Application so make sure that this option is selected. This will cause the New Project window to appear containing a range of different types of project. Do this by selecting New Project from the File menu. Creating a new Visual Studio C# ProjectOnce Visual Studio is running the first step is to create a new project.Scroll to the top of the list of properties until the (Name) value is visible and change this name from textBox1 to welcomeText:Repeat the above task by selecting each component in the Form in turn and changing the (Name) property. Begin by selecting the top TextEdit component in the Form area so that the panel displays the properties for this component. This and other properties relating to components are specified through the Properties panel which is located in the bottom right hand corner of the main Visual Studio window.
Enter some text into the TextBoxes to prove it is a live application. After a few seconds the executing application will appear. Repeat this for closeButton so that it displays Close.To try out the application so far press the F5 button on your keyboard to build and run the application. Select helloButton in the Form, scroll down the list of properties to locate the Text value and change it from button1 to Hello. To demonstrate this concept we will change the text on the two buttons such that they read "Hello" and "Close". Visual Studio Desktop Application Code For TheThe display will change to show the code for the application. To display the code associated with the closeButton double click on it. All we need to do, therefore, is write some code for the Click events of our buttons. For example, when a button is pressed a Click event is triggered. This behavior is controlled via events. Text wrangler for mac hotkeyThe hello message will subsequently appear in the top text field. This time we will be adding code to the helloButton_Click event method to read the value from nameText, combine it with some extra text and then display the result in welcomeText: private void helloButton_Click(object sender, EventArgs e)WelcomeText.Text = "Hello " + nameText.Text We will learn more about what is happening in the above method in later chapters but in summary we are setting the Text property of the welcomeText component to a string comprised of a string containing "Hello " and the Text property value of the nameText component.Build and run the application by pressing F5 and when the application runs enter your name into the second text field and press the Hello button. Click on the Form1.cs tab above the code area to return to the visual view of the Form and double click on helloButton to access the code. This will take place when helloButton is pressed. We can achieve this by calling the Close() method in the closeButton_Click event: private void closeButton_Click(object sender, EventArgs e)The next task is to read the text entered into nameText and use it to display a message in welcomeText.
0 Comments
Leave a Reply. |
AuthorJermale ArchivesCategories |