11.8.14

How to: Collapse and Hide Sections of Code (Visual Basic)


The #Region directive enables you to collapse and hide sections of code in Visual Basic files. The #Region directive lets you specify a block of code that you can expand or collapse when using the Visual Studio code editor. 

The ability to hide code selectively makes your files more manageable and easier to read. For more information, see Outlining.


#Region directives support code block semantics such as #If...#End If. This means they cannot begin in one block and end in another; the start and end must be in the same block. #Region directives are not supported within functions.
To collapse and hide a section of code
Place the section of code between the #Region and #End Region statements, as in the following example:

#Region "This is the code to be collapsed" 
    Private components As System.ComponentModel.Container
    Dim WithEvents Form1 As System.Windows.Forms.Form

    Private Sub InitializeComponent()
        components = New System.ComponentModel.Container
        Me.Text = "Form1" 
    End Sub
#End Region

Source : MSDN 
http://msdn.microsoft.com/

Book Advices


Hi All,
Please find the some books advices

Books

Stephens' Visual Basic Programming 24-Hour Trainer


About The Book: Start from scratch, and even if you don t know a thing about Visual Basic, you soon will with this thorough introduction to Visual Basic programming. Using easy-to-follow lessons and step-by-step instruction, this practical book teaches you concepts and hands-on techniques, then reinforces your learning with video screencasts and supplemental materials. Follow the exercises, then access the Try It section on the DVD, and watch as well-known VB authority and author Rod Stephens works through programming problems.

Special Features: · Rod Stephens is a well-known authority on Visual Basic programming--his Visual Basic Programmer's Reference has sold more than 30,000 copies in three editions.· Unique Book/Video Package: Each lesson in the print product is supplemented by an instructional video, included on the accompanying DVD.· Perfect for beginners: no previous programming experience is required.· The author will promote his book via his online VB community, VBHelper, which receives more than 7 million hits monthly. · The author will provide ancillary support materials for instructors, facilitating training/higher ed sales.



Visual Basic 2012 Programmer's Reference

Microsoft Visual Basic (VB) is the most popular programming language in the world, with millions of lines of code used in businesses and applications of all types and sizes. In this edition of the bestselling Wrox guide, Visual Basic expert Rod Stephens offers novice and experienced developers a comprehensive tutorial and reference to Visual Basic 2012. This latest edition introduces major changes to the Visual Studio development platform, including support for developing mobile applications that can take advantage of the Windows 8 operating system.

This new edition includes information on developing Win8-compatible Metro applications using pre-loaded templates
Explores the new design features and support for WPF designers
Explains how to develop Windows smartphone apps
Covers new VB language features such as Asynch and Await
Visual Basic 2012 Programmer's Reference is the programmer's go-to reference for the 2012 edition of Visual Basic.



Rod Stephens started out as a mathematician, but while studying at MIT, he discovered how much fun algorithms are. He took every algorithms course MIT offered and has been writing complex algorithms ever since.
During his career, Rod has worked on an eclectic assortment of applications in such fields as telephone switching, billing, repair dispatching, tax processing, wastewater treatment, concert ticket sales, cartography, and training for professional football players.
Rod is a Microsoft Visual Basic Most Valuable Professional (MVP) and has taught introductory programming at ITT Technical Institute. He has written more than 2 dozen books that have been translated into languages from all over the world. He has also written more than 250 magazine articles covering C#, Visual Basic, Visual Basic for Applications, Delphi, and Java. (At one time, Rod was writing magazine columns in Visual Basic, Visual Basic for Applications, and Java all at the same time. Far too confusing!)
Rod's popular VB Helper web site (www.vb-helper.com) receives several million hits per month and contains tips, tricks, and example programs for Visual Basic programmers. His C# Helper web site (www.csharphelper.com) contains similar material for C# programmers.

www.amazon.com 




2.8.14

Publish your IT Article/Use v-basic.net email address


Hi All,
If you would like to publish your article/essay/code/note in www.v-basic.net blog, please just email me.
Then, I am happy to publish your contribution on this blog.

If you would like to submit regulary, please let me know  I can provide you an access as an Author.

Note: If you would like to use @ v-basic.net email domain, please let me know I can create an email access for you.

Regards,
Yener Turkeli
y_turkeli  @ yahoo .  com


28.1.13

Clock Class


Clock Class
Provides properties for accessing the current local time and Universal Coordinated Time (equivalent to Greenwich Mean Time) from the system clock.

'Declaration
<HostProtectionAttribute(SecurityAction.LinkDemand, Resources := HostProtectionResource.ExternalProcessMgmt)> _
Public Class Clock
GmtTime Gets a Date object that contains the current local date and time on the computer, expressed as a UTC (GMT) time.

LocalTime Gets a Date object that contains the current local date and time on this computer.

MsgBox("Local Time: " + My.Computer.Clock.LocalTime)
Have a nice day
Yener Turkeli

27.1.13

Audio Class




Audio Class

Provides methods for playing sounds.

'Declaration
<HostProtectionAttribute(SecurityAction.LinkDemand, Resources := HostProtectionResource.ExternalProcessMgmt)> _
Public Class Audio

Play(String) Plays a .wav sound file.


Stop Stops a sound playing in the background.

Play(String, AudioPlayMode) Plays a .wav sound file.


My.Computer.Audio.Play("D:\my_file.mp3")
My.Computer.Audio.Stop()

2.1.13

Start the Process





Hi All,
I would like to explain one of faq within this essay , how we start the new process .
If any question, please feel free to contact me yenerturkeli@v-basic.net.

Imports System
Imports System.Diagnostics
Imports System.ComponentModel

Namespace MyProcessSample
    Class MyProcess
            ' Opens the Internet Explorer application.
            Public Sub OpenApplication(myFavoritesPath As String)
            ' Start Internet Explorer. Defaults to the home page.
            Process.Start("IExplore.exe")

            ' Display the contents of the favorites folder in the browser.
            Process.Start(myFavoritesPath)
        End Sub 'OpenApplication

        ' Opens urls and .html documents using Internet Explorer.
        Sub OpenWithArguments()
            ' url's are not considered documents. They can only be opened
            ' by passing them as arguments.
            Process.Start("IExplore.exe", "www.northwindtraders.com")

            ' Start a Web page using a browser associated with .html and .asp files.
            Process.Start("IExplore.exe", "C:\myPath\myFile.htm")
            Process.Start("IExplore.exe", "C:\myPath\myFile.asp")
        End Sub 'OpenWithArguments

        ' Uses the ProcessStartInfo class to start new processes,
        ' both in a minimized mode.
        Sub OpenWithStartInfo()
            Dim startInfo As New ProcessStartInfo("IExplore.exe")
            startInfo.WindowStyle = ProcessWindowStyle.Minimized

            Process.Start(startInfo)

            startInfo.Arguments = "www.northwindtraders.com"

            Process.Start(startInfo)
        End Sub 'OpenWithStartInfo

        Shared Sub Main()
            ' Get the path that stores favorite links.
            Dim myFavoritesPath As String = Environment.GetFolderPath(Environment.SpecialFolder.Favorites)

            Dim myProcess As New MyProcess()

            myProcess.OpenApplication(myFavoritesPath)
            myProcess.OpenWithArguments()
            myProcess.OpenWithStartInfo()
        End Sub 'Main
    End Class 'MyProcess
End Namespace 'MyProcessSample

Resource: MSDN Process Class

Have a nice day
Yener Turkeli

28.12.12

Kill the Window Process




Hi Everybody,
I would like to explain one of faq within this essay , how we kill the window process .
If any question, please feel free to contact me yenerturkeli@v-basic.net.

A Process component provides access to a process that is running on a computer. A process, in the simplest terms, is a running application. A thread is the basic unit to which the operating system allocates processor time. A thread can execute any part of the code of the process, including parts currently being executed by another thread.

The Process component is a useful tool for starting, stopping, controlling, and monitoring applications. Using the Process component, you can obtain a list of the processes that are running, or you can start a new process. A Process component is used to access system processes. After a Process component has been initialized, it can be used to obtain information about the running process. Such information includes the set of threads, the loaded modules (.dll and .exe files), and performance information such as the amount of memory the process is using.

You can use the code as below

Imports System.Diagnostics
dim my_process_name as string
Dim all_process As System.Diagnostics.Process
        For Each all_process In System.Diagnostics.Process.GetProcesses()
           Dim selected_process As String = my_process.Split("-").Trim()
         
            If all_process.ProcessName = selected_process Then
                all_process.Kill()
            End If
        Next

Have a nice day,
Yener Turkeli