22.4.11

XML import and Export


Hi Everybody,
I would like to discuss one of the most common FAQs regarding how we can import and export XML data by DataGridView? If any question, please feel free and contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

1-)We are creating a new Windows Application Project (xml_to_datagridview)



2-) We are designing this windows form in a similar way to the picture below



3-) We are writing this code

Imports System.Xml
Imports System.Data


Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'create a openfile dialog
Dim open_file As New OpenFileDialog

'give its filter
open_file.Filter = "Files (*.xml) | *.xml"

Try

'if ok click at opendialog
If open_file.ShowDialog() = DialogResult.OK Then

'define a xml reader
Dim xmlFile As XmlReader

'get xml data from the path
xmlFile = XmlReader.Create(open_file.FileName, New XmlReaderSettings())

'define a new dataset
Dim ds As New DataSet

'read xml data
ds.ReadXml(xmlFile)

'show xml data in datagridview
DataGridView1.DataSource = ds.Tables(0)

End If

Catch ex As Exception

'if any problem show error
Msgbox(ex.message)


End Try






End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

'define a save dialog
Dim save_file As New SaveFileDialog

'give its extension
save_file.Filter = "xml files (*.xml)|*.xml|All files (*.*)|*.*"

'select xml
save_file.FilterIndex = 2


'create a datatable
Dim my_datatable As New DataTable

'if ok click
If save_file.ShowDialog() = DialogResult.OK Then

'get datagridview source to datatable
my_datatable = CType(DataGridView1.DataSource, DataTable)


'save datatable with xml format
my_datatable.WriteXml(save_file.FileName)


End If



End Sub
End Class


4-) sample xml file



5-) Lets run application and clicks save and open file buttons



Have a great day
Yener Turkeli

20.4.11

STEGANOGRAPHY PROJECT


Hi Everybody,
I would like to discuss one of the most common FAQs regarding how we can hide data into the image with VB.NET Windows application? If any question, please feel free and contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

Information security, today the importance of the personal basis so much as the guarantee of the future of some communities and private business working in the units / institutions are very important . Cryptography is the practice and study of hiding information. In modern times cryptography is considered a branch of both mathematics and computer science and is affiliated closely with information theory, computer security and engineering.

This method is a new approach to Steganography which is the art and science of writing hidden messages in such a way that no-one, apart from the sender and intended recipient, suspects the existence of the message, a form of security through obscurity. We are using RGB codes and pixel for hide data inside the image.

1-) We can directly hide data inside the image



2-) This programme cannot change image quality .



3-) Data was hidden to image in just a short time without a problem.



4-) You can read data from hidden image whenever you want. This data is coming from hidden image.




You can contact me , if any question about the project.


Yener Turkeli
yenerturkeli@v-basic.net


17.4.11

Working with TCP IP Ports

Hi Everybody,
I would like to explain most common question within this essay , how we can work TCP Port with VB.NET 2010 console application? If any question, please feel free and contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

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



2-) We are writing this code

Imports System.Net.Sockets
Imports System.Text

Module Server

'define the port number
Const Port_num As Integer = 1024

Sub Main()

'write port listener to the screen
Console.WriteLine("Port Listener")

'create a tcplistiner
Dim port_Listener As New TcpListener(Port_num)

'write information the screen
Console.WriteLine("Starting to Port Listening...")

'start to listen to the port
port_Listener.Start()


Try

'accept the listener
Dim my_Client As TcpClient = port_Listener.AcceptTcpClient()

'give information to the screen
Console.WriteLine("Port Connection Accepted.")

'get stream
Dim net_s As NetworkStream = my_Client.GetStream()


Try

'define byte variable
Dim bytes(1024) As Byte

'get data
Dim bytesRead As Integer = net_s.Read(bytes, 0, bytes.Length)


'write data to the screen
Console.WriteLine(Encoding.ASCII.GetString(bytes, 0, bytesRead))

Catch e As Exception

'any problem show to the screen
Console.WriteLine(e.message)

End Try


'stop listener
port_Listener.Stop()

Catch
Console.WriteLine("Error")
Console.ReadLine()
End Try

End Sub

End Module

3-) Lets run the application ( give permission for the programme)





Have a great day


Yener Turkeli
yenerturkeli@v-basic.net


1.4.11

MSDos Commands with Console Application

Hi Everybody,
I would like to explain most common question within this essay , how we can use MSDOS command with VB.NET 2010 console application? If any question, please feel free and contact me y_turkeli@yahoo.com or yenerturkeli@v-basic.net.

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




2-) We are writing this code

Sub Main()
'change background color
Console.BackgroundColor = ConsoleColor.Yellow

'change forecolor
Console.ForegroundColor = ConsoleColor.DarkBlue


Dim scommand As String

'command line
scommand = "move c:\test\*.* c:\test\test"

'write information to the screen
Console.WriteLine("Do you want to see command screen? Y or N")

'get user's preferrence
Dim s_view As String = Console.ReadLine


'if user prefer Y
If s_view = "Y" Then

'run command line and show command screen
Shell("cmd /c " & scommand, AppWinStyle.MaximizedFocus)

'if user prefer N
ElseIf s_view = "N" Then

'run command line and hide command screen
Shell("cmd /c " & scommand, AppWinStyle.Hide)
Else

Exit Sub
End If


Console.ReadLine()



End Sub

3-) Lets run application



4-) Check files from the directory