Presentation is loading. Please wait.

Presentation is loading. Please wait.

Visual Basic 2005 Express Corrado Cavalli Microsoft.NET MVP

Similar presentations


Presentation on theme: "Visual Basic 2005 Express Corrado Cavalli Microsoft.NET MVP"— Presentation transcript:

1 Visual Basic 2005 Express Corrado Cavalli Microsoft.NET MVP

2 Imparare.NET Interazione tra studenti Creare applicazioni Imparare VB i Hobbisti Studenti UniversitariAppassionati

3 ExpressStandardProTeam Windows or Web Designers Code Editors and IntelliSense Programming Languages Remote Data Access Mobile Device Development User Experience SimplifiedSimplified Server Development/Debugging SQL Server 2005 Development Application Modeling, Code Profiling, Unit Testing, Static Code Analysis, Load Testing, Enterprise Source Control, Work Item Tracking

4 Cosa cè di nuovo? Edit and Continue My Generics Click Once Data Sources Windows Object Binding Web Service Binding Debugger Visualizers Just My Code Debugging The Exception Assistant Design Time Expression Evaluation IntelliSense Code Snippets XML Comments Error Correction and Warnings Rename Attribute Editing IntelliSense Filtering IntelliSense in Zone New VB Item Templates Find References Exportable Development Settings Simplified Tools -> Options Project Designer Starter Kits XML Editor Zero Impact Projects Start Page Authenticode signing support Custom Setup Bootstrapper Big 5 Bootstrapper packages (Fx 2.0, SSE, etc.) Strongly typed Resources Registration Free COM Strongly typed Settings Using statement Continue statement Global keyword Accessor accessibility Partial types Unsigned types Operator overloading Warnings Custom Events TableAdapters DataSet Designer Drag Once Form creation Smart Tags Parameterized query Connect the Dots databinding Custom Control drag / drop Lookup table binding Upgrade WebBrowser Upgrade Masked Edit Upgrade Rich textbox Upgrade Windows Common Controls –TreeView, ListView, ImageList –ToolBar, StatusBar, ProgressBar Upgrade Common Dialogs Upgrade MTS/COM+ Projects Upgrade BackgroundImageLayout Property Upgrade keys in KeyPress event Upgrade additional Keywords Updated Keys In Control Collections Upgrade Unload Mode in FormClosing Event

5 Whats new: Linguaggio Generics Partial Types IsNot Accessor accessibility Continue Operator overloading My

6 Generics Private _Items As Collection Private Sub Class_Initialize() Set _Items = New Collection Set _Items = New Collection End Sub Private Sub Class_Terminate() Set _Items = Nothing Set _Items = Nothing End Sub Public Function NewEnum() As stdole.IUnknown Set NewEnum = moItems.[_NewEnum] Set NewEnum = moItems.[_NewEnum] End Function Public Function Item(Key As String) As Person On Error Resume Next On Error Resume Next Set Item = _Items.Item(Key) Set Item = _Items.Item(Key) End Function Public Property Get Count() As Long Count = _Items.Count Count = _Items.Count End Property Public Sub Add(Person As Person, Key As String) _Items.Add Text, Text.Key _Items.Add Text, Text.Key End Sub Public Sub Remove(Index As Integer) _Items.Remove Index _Items.Remove Index End Sub Public Class Cars : Inherits CollectionBase Public Sub Add(ByVal item As Person) Public Sub Add(ByVal item As Person) MyBase.InnerList.Add(item) MyBase.InnerList.Add(item) End Sub End Sub Default Property Item(ByVal index As Integer) As Person Default Property Item(ByVal index As Integer) As Person Get Get Return DirectCast(MyBase.InnerList(index), Person) Return DirectCast(MyBase.InnerList(index), Person) End Get End Get Set(ByVal Value As Person) Set(ByVal Value As Person) MyBase.InnerList(index) = Value MyBase.InnerList(index) = Value End Set End Set End Property End Property End Class VB6 VB.NET VB2005 Dim Cars As New List(Of Car) Cars.Add(New Car()) Permettono la definizionedi tipi incompleti che verrano completati a compile time.

7 File Class1.vb Public Class Car Public Sub Start() Public Sub Start() End Sub End Sub End Class File Class2.vb Public Partial Class Car Public Sub Stop() Public Sub Stop() End Sub End Sub End Class Dim T As New Car() T.Start()T.Stop() Partial Types

8 IsNot Public Sub Test(ByVal o As SomeType) If Not o Is Nothing Then If Not o Is Nothing Then o.DoSomething() o.DoSomething() Else Else Throw New NullReferenceException() Throw New NullReferenceException() End If End If End Sub Public Sub Test(ByVal o As SomeType) If o IsNot Nothing Then If o IsNot Nothing Then o.DoSomething() o.DoSomething() Else Else Throw New NullReferenceException() Throw New NullReferenceException() End If End If End Sub

9 Accessor Accessibility Assembly Foo.dll Public Class Person Private mName As String Public ReadOnly Property Name() As String Get Return mName End Get End Property Friend WriteOnly Property SetName() As String Set(ByVal value As String) mName = value End Set End Property End Class Assembly Foo.dll Public Class Person Private mName As String Private mName As String Public Property Name() As String Public Property Name() As String Get Get Return mName Return mName End Get End Get Friend Set(ByVal value As String) Friend Set(ByVal value As String) mName = value mName = value End Set End Set End Property End Property End Class

10 Continue Trasferisce il controllo alliterazione successiva di un ciclo For,Do, While For i as Int32=0 to 10 If (i mod 2 =0 ) Then Continue For If (i mod 2 =0 ) Then Continue For Debug.WriteLine(i) 1,3,5,7,9 Debug.WriteLine(i) 1,3,5,7,9Next Dim i, j, k As Int32 Dim rnd As New Random(DateTime.Now.Millisecond) For i = 0 To 5 j = 0 While (j = 90) Then Continue For Loop Until k > j End While Debug.WriteLine(String.Format("{0} {1} {2}", i, j, k)) Next

11 Operator Overloading Public Class SetPoint Public Temperature as Single Public Sub New (value as Single) Me.Temperature=value End Sub End Class Me.Temperature=value End Sub End Class Dim T1 as New SetPoint(12.5) Dim T2 as New SetPoint(13) Dim T3 as SetPoint = T1 + T2 Public Class SetPoint Public Temperature as Single Public Sub New (value as Single) Me.Temperature=value End Sub Me.Temperature=value End Sub Public Shared Operator +(ByVal a As SetPoint,_ ByVal b As SetPoint) As SetPoint ByVal b As SetPoint) As SetPoint Return New SetPoint(a.Temperature + b.Temperature) Return New SetPoint(a.Temperature + b.Temperature) End Operator End Class

12 My Application Computer User Resources Settings Forms WebServices Application title, version, logs, description, … Registry, Printer, Audio, File System, … User name, group, domain, … Accesso alle risorse di un applicazione User e application settings Collezione dei form presenti nel progetto Collezione dei web services referenziati My Namespace

13 Compiler & IDE Features Edit & Continue –Modificare il sorgente durante il debug senza riavviare Autocorrect –Smart tag di autocorrezione Expansions/Snippets –Inserimento di blocchi di codice XML Comments Import / Export settings Warnings –Analisi dettagliata del codice Enhanced debugging –Debugger Visualizers –Debugger DataTips

14 Novità dei controlli windows Smart Tags Form –ValidateChildren –Eventi FormClosing, StyleChanged TextBox –AutoComplete Masked Textbox PictureBox –Può caricare immagini da URL in modo asincrono –LoadAsync(www.mysite.org/image.gif)www.mysite.org/image.gif WebBrowser Enhanced ListView –Può visualizzare informazioni raggruppate –Virtual Mode Treeview –Supporta modalità OwnerDrawn

15 Novità dei controlli windows ToolStrip, MenuStrip, StatusStip, ToolStripContainer –Permettono di avere GUI Office like SerialPort FlowLayouPanel, TableLayoutpanel,SplitContainer DatagridView –Nuova grid data-aware, rimpiazza il controllo Datagrid Progressbar –Marquee mode BackgroundWorker –Esegue operazioni in secondary thread gestendo il necessario marshaling

16 Drag & Drop Databinding

17 ClickOnce Applicazioni – Windows Difficili da aggiornare –Web Server centrale, fix once. Più difficile scrivere le applicazioni No Offline mode Creazione di Smart Client –Installazione da Web Online Online/Offline –Autoupdate dellapplicazione Allo startup Dopo lo startup ad intervalli predefiniti Via codice (System.Deployment) RegFree COM

18 Quanto costa? Gratis! –Scaricate le versioni da MSDN –Potete usare le versioni Express per scopi commerciali ~50 –DVD –Esempi e Starter Kits –Documentazione aggiuntiva

19 © 2005 Microsoft Corporation. All rights reserved. This presentation is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN


Download ppt "Visual Basic 2005 Express Corrado Cavalli Microsoft.NET MVP"

Similar presentations


Ads by Google