18.8.10

VB.NET Directory Create and Check

Hi Everybody,
I would like to discuss one of the most FAQs regarding how we can create a directory and check directory in local drive with VB.NET 2010 console application ? If you have any questions, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.


1-) We are creating a new Console Application Project (create_directory)



2-) We are writing this code


Imports System.IO

Module Module1

Sub Main()
Dim dir_path As String

Try
Console.BackgroundColor = ConsoleColor.Blue
Console.ForegroundColor = ConsoleColor.Red
Console.WriteLine("Please write directory path")
dir_path = Console.ReadLine

If Not Directory.Exists(dir_path) Then
Console.BackgroundColor = ConsoleColor.Green
Console.ForegroundColor = ConsoleColor.White
Console.WriteLine("Directory will create at:" & dir_path)
Directory.CreateDirectory(dir_path)

Else
Console.BackgroundColor = ConsoleColor.Red
Console.ForegroundColor = ConsoleColor.White
Console.WriteLine("Directory exist at:" & dir_path)

End If
Catch ex As Exception

End Try



Console.ReadLine()
End Sub

End Module

3-) Lets start program(F5)






If directory exist.



Have a great day
Yener Turkeli

10.8.10

Get Directory List VB.NET 2010


Hi Everybody,
I would like to discuss one of the most FAQs regarding how we can see directory list on local driver with VB.NET 2010 Windows application ? If you have any questions, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

1-) We are creating a new Console Application Project (get_directories)



2-) We are writing this code


Sub Main()

Dim directory_path As String
Console.WriteLine("Please write directory name")
directory_path = Console.ReadLine

Console.WriteLine("All Directory List")

For Each dir_Folder As String In _
My.Computer.FileSystem.GetDirectories(directory_path)

Console.WriteLine(dir_Folder.ToString)



Next

Console.ReadLine()

End Sub

3-) Lets start program(F5)






Have a great day

Yener Turkeli
yenerturkeli@v-basic.net

2.8.10

is Internet Available?

Hi Everybody,
I would like to discuss one of the most FAQs regarding how we can point out internet is available with VB.NET ? If you have any questions, please feel free to contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

1-) We are creating a new Console Application Project (internet_checker)



2-) We are writing this code


Function check_internet() As Boolean
Dim vb_url As New System.Uri("http://www.v-basic.net")
Dim vb_WebR As System.Net.WebRequest
vb_WebR = System.Net.WebRequest.Create(vb_url)
Dim vb_response As System.Net.WebResponse
Try

vb_response = vb_WebR.GetResponse
vb_response.Close()
vb_WebR = Nothing
Return True
Catch ex As Exception


vb_WebR = Nothing

Return False
End Try
End Function



Sub Main()
Console.WriteLine("Internet Connection is checking")
If check_internet() = True Then
Console.ForegroundColor = ConsoleColor.White
Console.BackgroundColor = ConsoleColor.Green
Console.WriteLine("Internet Connection is available")

Else
Console.WriteLine("Internet Connection is unavailable")
End If

Console.Read()
End Sub

3-) Lets start program(F5)


Have a great day