380 likes | 587 Views
VISUAL BASIC 2005 EXPRESS. - Lakoća programiranja - Dragan Janković Katedra za Računarstvo Elektronski fakultet, Niš. Sve to može ovako. A može i ovako. Express Pro izvodi. Učenje .NET. Učenje VB. Kreiranje apli kacija. Penzioneri. Hobi. U čenici. Studenti. RAD ?. Brzo u č enje
E N D
VISUAL BASIC 2005 EXPRESS - Lakoća programiranja - Dragan Janković Katedra za Računarstvo Elektronski fakultet, Niš
A može i ovako Express Proizvodi
Učenje.NET Učenje VB Kreiranjeaplikacija Penzioneri Hobi Učenici Studenti
RAD ? • Brzo učenje • Motivacija • Brz i efikasan razvoj aplikacija • Gotovi elementi interfejsa • Programiranje upravljano dogadjajima • “Programiranje mišem” • Drag & Drop • Podesi • Dopuni
VB2005 .NET Visual Basic VB .NET Jednostavnije i efikasnije Basic
Visual Basic .NET • Unapredjen jezik • Potpuno podržana OO paradigma: • Klase, nasleđivanje, konstruktori, destruktori • Overloading, polimorfizam, ... • Obrada izuzetaka • Potpuni pristup .NET frameworku • Multithread, garbage collection • Unapredjen razvoj Web apikacija • Kreiranje Web formi po ugledu na Windows forme • Kreiranje Web servisa – jednostavno • Poboljšan security • Jednostavan i fleksibilan deployment
Šta je novo? • 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 • 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
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 • 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
Nešto više o ... • Generics • Partial Types • IsNot • Continue • Operator overloading • My Object (namespace) • Code Snippets • …
Generics Private _Items As Collection Private Sub Class_Initialize() Set _Items = New Collection End Sub Private Sub Class_Terminate() Set _Items = Nothing End Sub Public Function NewEnum() As stdole.IUnknown Set NewEnum = moItems.[_NewEnum] End Function Public Function Item(Key As String) As Person On Error Resume Next Set Item = _Items.Item(Key) End Function Public Property Get Count() As Long Count = _Items.Count End Property Public Sub Add(Person As Person, Key As String) _Items.Add Text, Text.Key End Sub Public Sub Remove(Index As Integer) _Items.Remove Index End Sub VB6 Public Class Cars : Inherits CollectionBase Public Sub Add(ByVal item As Person) MyBase.InnerList.Add(item) End Sub Default Property Item(ByVal index As Integer) As Person Get Return DirectCast(MyBase.InnerList(index), Person) End Get Set(ByVal Value As Person) MyBase.InnerList(index) = Value End Set End Property End Class VB.NET VB2005 Dim Cars As New List(Of Car) Cars.Add(New Car())
Zašto Generics? • Kod tipiziran • Izbegnute run-time greške • IntelliSense radi • Bolje performanse • Primer: Efikasnost realizacije primenom • Array 344 • ArrayList 4656 • Generic List 797
Partial Types File Class1.vb Public Class Car Public Sub Start() End Sub End Class Dim T As New Car() T.Start() T.Stop() File Class2.vb Public Partial Class Car Public Sub Stop() End Sub End Class
IsNot Operator Public Sub Test(ByVal o As SomeType) If Not o Is Nothing Then o.DoSomething() Else Throw New NullReferenceException() End If End Sub Public Sub Test(ByVal o As SomeType) If o IsNot Nothing Then o.DoSomething() Else Throw New NullReferenceException() End If End Sub
Continue Dim i, j, k As Int32Dim rnd As New Random(DateTime.Now.Millisecond)For i = 0 To 5 j = 0While (j < 3) j += 1 k = 0Do k += 1 If (rnd.Next(100) >= 90) Then Continue ForLoop Until k > jEnd While Debug.WriteLine(String.Format("{0} {1} {2}", i, j, k))Next For i as Int32=0 to 10 If (i mod 2 =0 ) Then Continue For Debug.WriteLine(i) ‘ 1,3,5,7,9 Next
Overloading operatora Public Class SetPoint Public Temperature as Single Public Sub New (value as Single) Me.Temperature=value End Sub Public Shared Operator +(ByVal a As SetPoint,_ ByVal b As SetPoint) As SetPoint Return New SetPoint(a.Temperature + b.Temperature) End Operator End Class Public Class SetPoint Public Temperature as Single Public Sub New (value as Single) Me.Temperature=value End SubEnd Class Dim T1 as New SetPoint(12.5)Dim T2 as New SetPoint(13)Dim T3 as SetPoint = T1 + T2
Overloading operatora(2) • Public Class Complex • Public Real As Double • Public Imag As Double • Public Sub New(ByVal rp As Double, ByVal ip As Double) • Real = rp • Imag = ip • End Sub • Shared Operator +(ByVal lhs As Complex, ByVal rhs As Complex)_ • As Complex • Return New Complex(lhs.Real + rhs.Real, lhs.Imag + rhs.Imag) • End Operator • End Class • 'new Complex + operator works intuitively • Dim lhs As Complex = New Complex(2.1, 3.3) • Dim rhs As Complex = New Complex(2.5, 4.6) • Dim res As Complex = lhs + rhs • 'res.real = 4.6, res.imag = 7.9
My Namespace — Application title, version, logs, description, … — Registry, Printer, Audio, File System, … — User name, group, domain, … —Pristup resursi aplikacije: icons, images, … — User i application settings —Kolekcija formi u aplikaciji, show / hide — Jednostavan pristup web servisima ukjučenim u projekat (Web references)
My.Resources • PictureBox1.Image = My.Resources.Logo • My.Settings • My.Settings.FormLocation = Me.Location • My.Forms • My.Forms.Form1.Show • My.WebServices • My.WebServices.MSDN.Search(“VB”)
Code Snippets Desni-klik u editoru koda i selekcija taska izaziva insetovanje ranije pripremljenog koda.
Help • Dinamički help • Context-Sensitive Help
Kako učiti? • 2373B Programming with Microsoft Visual Basic .NET • Microsoft IT Academy – Elektronski fakultet u Nišu • PIL program:Microsoft Software & ELEF • Portal: www.pil-vb.net • Dušan Vučković, Elektronski fakultet, Niš • dvuckovic@elfak.ni.ac.yu • gaga@elfak.ni.ac.yu
VB.NET 2005