Visual Basic (.NET): Difference between revisions

Content deleted Content added
m remove arbitrary fixed sizes
Removed a space.
Line 36:
The Windows Forms library is most commonly used to create GUI interfaces in Visual Basic. All visual elements in the Windows Forms class library derive from the Control class. This provides the minimal functionality of a user interface element such as ___location, size, color, font, text, as well as common events like click and drag/drop. The Control class also has docking support to let a control rearrange its position under its parent.
 
Forms are typically designed in the [[Visual Studio]] [[Integrated development environment|IDE]]. In Visual Studio, forms are created using [[drag-and-drop]] techniques. A tool is used to place controls (e.g., text boxes, buttons, etc.) on the form (window). Controls have [[Attribute (computing)|attributes]] and [[event handler]]s associated with them. Default values are provided when the control is created, but may be changed by the programmer. Many attribute values can be modified during run time based on user actions or changes in the environment, providing a dynamic application. For example, code can be inserted into the form resize event handler to reposition a control so that it remains centered on the form, expands to fill up the form, etc. By inserting code into the event handler for a keypress in a text box, the program can automatically translate the case of the text being entered, or even prevent certain characters from being inserted.
 
== Syntax ==
Line 202:
{{Main|Comparison of C Sharp and Visual Basic .NET}}
 
C# and Visual Basic are Microsoft's first languages made to program on the .NET Framework (later adding [[F Sharp (programming language)|F#]] and more; others have also added languages). Though C# and Visual Basic are syntactically different, that is where the differences mostly end. Microsoft developed both of these languages to be part of the same .NET Framework development platform. They are both developed, managed, and supported by the same language development team at Microsoft.<ref>{{cite web |last=Krill |first=Paul |url=http://www.infoworld.com/article/09/02/27/Microsoft_converging_programming_languages_1.html?R=printThis&A=/article/09/02/27/Microsoft_converging_programming_languages_1.html |archive-url=https://archive.today/20130126074556/http://www.infoworld.com/article/09/02/27/Microsoft_converging_programming_languages_1.html?R=printThis&A=/article/09/02/27/Microsoft_converging_programming_languages_1.html |url-status=dead |archive-date=January 26, 2013 |title=Microsoft converging programming languages &#124; Developer World |publisher=InfoWorld |date=February 27, 2009 |access-date=August 18, 2013 }}</ref> They compile to the same intermediate language (IL), which runs against the same .NET Framework runtime libraries.<ref>{{cite web |url=http://www.dotnet-guide.com/msintermediate.html |title=Microsoft Intermediate Language |publisher=Dotnet-guide.com |access-date=August 18, 2013 |archive-date=June 2, 2013 |archive-url=https://web.archive.org/web/20130602151947/http://www.dotnet-guide.com/msintermediate.html |url-status=live }}</ref> Although there are some differences in the programming constructs, their differences are primarily syntactic and, assuming one avoids the Visual Basic "Compatibility" libraries provided by Microsoft to aid conversion from Visual Basic 6, almost every feature in VB has an equivalent feature in C# and vice versa. Lastly, both languages reference the same Base Classes of the .NET Framework to extend their functionality. As a result, with few exceptions, a program written in either language can be run through a simple syntax converter to translate to the other. There are many open source and commercially available products for this task.
 
== Examples ==