Imports System.Net
Dim computer_name() As String
computer_name = Split(System.Net.Dns.GetHostEntry(Request.ServerVariables("remote_addr")).HostName, ".")
Response.Write(computer_name(0).ToUpper)
OR
Dim strComputerName As String
Dim host As System.Net.IPHostEntry
host = System.Net.Dns.GetHostEntry(Request.ServerVariables.Item("REMOTE_HOST"))
strComputerName = host.HostName
Response.Write(strComputerName)
ALL kind of coding material related to software development. Microsoft Visual Studio. HTML VBA SQL
Wednesday, December 15, 2010
VB.NET Read from TEXT File
Dim FILENAME As String = "c:\IP.txt"
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(FILENAME)
Dim contents As String = objStreamReader.ReadToEnd()
Button1.Text = contents
objStreamReader.Close()
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(FILENAME)
Dim contents As String = objStreamReader.ReadToEnd()
Button1.Text = contents
objStreamReader.Close()
VB.NET Insert into TEXT File
Imports System.IO
Dim FILENAME As String = Server.MapPath("IP.txt")
OR
Dim FILENAME As String = "c:\IP.txt"
Dim objStreamWriter As StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine("External ip :" & externalip)
objStreamWriter.WriteLine("Local ip :" & localipaddresses)
objStreamWriter.WriteLine("Remote ip :" & strip)
objStreamWriter.WriteLine("DateTime :" & DateTime.Now)
objStreamWriter.WriteLine("----------------------------------")
objStreamWriter.Close()
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(FILENAME)
Dim contents As String = objStreamReader.ReadToEnd()
objStreamReader.Close()
Dim FILENAME As String = Server.MapPath("IP.txt")
OR
Dim FILENAME As String = "c:\IP.txt"
Dim objStreamWriter As StreamWriter
objStreamWriter = File.AppendText(FILENAME)
objStreamWriter.WriteLine("External ip :" & externalip)
objStreamWriter.WriteLine("Local ip :" & localipaddresses)
objStreamWriter.WriteLine("Remote ip :" & strip)
objStreamWriter.WriteLine("DateTime :" & DateTime.Now)
objStreamWriter.WriteLine("----------------------------------")
objStreamWriter.Close()
Dim objStreamReader As StreamReader
objStreamReader = File.OpenText(FILENAME)
Dim contents As String = objStreamReader.ReadToEnd()
objStreamReader.Close()
Monday, December 13, 2010
VB.NET Getting Local ip of Client
Dim hostname As String
hostname = System.Net.Dns.GetHostName()
Dim localipaddresses As New IPHostEntry
localipaddresses = Dns.GetHostEntry(hostname)
Response.Write("Your Local IP Address is: " & localipaddresses.AddressList(0).ToString() & "</em><br />")
hostname = System.Net.Dns.GetHostName()
Dim localipaddresses As New IPHostEntry
localipaddresses = Dns.GetHostEntry(hostname)
Response.Write("Your Local IP Address is: " & localipaddresses.AddressList(0).ToString() & "</em><br />")
Thursday, December 9, 2010
WPF Run Exe and Open URL in a Browser Window
System.Diagnostics.Process.Start("D:\2010-2011\smcen2010\optics2010.exe")
System.Diagnostics.Process.Start("http://122.160.43.248/labpendency")
System.Diagnostics.Process.Start("http://122.160.43.248/labpendency")
Wednesday, December 8, 2010
VB.NET Capture Client Machine Remote IP
- Dim strClientIP As String
- strClientIP = Request.UserHostAddress()
- Response.Write(strClientIP)
VB.NET Run exe
Dim startInfo As System.Diagnostics.ProcessStartInfo
Dim pStart As New System.Diagnostics.Process
startInfo = New System.Diagnostics.ProcessStartInfo("C:\file.exe")
pStart.StartInfo = startInfo
pStart.Start()
pStart.WaitForExit()
'Your code will halt until the exe file has executed.
Dim pStart As New System.Diagnostics.Process
startInfo = New System.Diagnostics.ProcessStartInfo("C:\file.exe")
pStart.StartInfo = startInfo
pStart.Start()
pStart.WaitForExit()
'Your code will halt until the exe file has executed.
Wednesday, October 27, 2010
VB.NET (Wndows) Fill Datagrid with Access table
Imports System.Data.OleDb
Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapter
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\avs.mdb;Persist Security Info=False"
oConn = New OleDbConnection(sConn)
sComm = "select distinct party from avst"
oComm = New OleDbDataAdapter(sComm, oConn)
oComm.Fill(oDataSet, "avst")
DataGridparty.DataSource = oDataSet.Tables("avst").DefaultView
DataGridparty.Refresh()
Dim oConn As OleDbConnection
Dim oComm As OleDbDataAdapter
Dim sConn As String
Dim sComm As String
Dim oDataSet As New DataSet
sConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\avs.mdb;Persist Security Info=False"
oConn = New OleDbConnection(sConn)
sComm = "select distinct party from avst"
oComm = New OleDbDataAdapter(sComm, oConn)
oComm.Fill(oDataSet, "avst")
DataGridparty.DataSource = oDataSet.Tables("avst").DefaultView
DataGridparty.Refresh()
Tuesday, October 12, 2010
VB.NET Creating Zip File
//Imports System.IO
Dim emptyZip As Byte() = {80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Dim oApp As Object
'Destination Zip File Name Here
File.WriteAllBytes("c:\avs.zip", emptyZip)
oApp = CreateObject("Shell.Application")
'Source File Name
oApp.Namespace("c:\avs.zip").CopyHere("c:\avs.mdb")
MsgBox("Zipped..")
Dim emptyZip As Byte() = {80, 75, 5, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Dim oApp As Object
'Destination Zip File Name Here
File.WriteAllBytes("c:\avs.zip", emptyZip)
oApp = CreateObject("Shell.Application")
'Source File Name
oApp.Namespace("c:\avs.zip").CopyHere("c:\avs.mdb")
MsgBox("Zipped..")
Wednesday, September 22, 2010
VB 6.0 Create Backup of a Table
mdbpassword = "9990513523"
file2 = "account.mdb"
cn3.Open "Provider=MSDataShape.1;Data Provider = Microsoft.Jet.OLEDB.3.51;Jet OLEDB:Database Password=" & mdbpassword & ";data source=" & file2
c = InputBox("Enter Table Name to Save::::Use only Numbers and Alphabets..", "Save Table")
If c = "" Then
cn3.Close
Exit Sub
Else
cn3.Execute "select * into [" & c & "] from attendance"
cn3.Execute "delete values from attendance"
cn3.Close
MsgBox "Table " & c & " Saved", vbInformation, "Saving Information..."
Att.Refresh
End If
file2 = "account.mdb"
cn3.Open "Provider=MSDataShape.1;Data Provider = Microsoft.Jet.OLEDB.3.51;Jet OLEDB:Database Password=" & mdbpassword & ";data source=" & file2
c = InputBox("Enter Table Name to Save::::Use only Numbers and Alphabets..", "Save Table")
If c = "" Then
cn3.Close
Exit Sub
Else
cn3.Execute "select * into [" & c & "] from attendance"
cn3.Execute "delete values from attendance"
cn3.Close
MsgBox "Table " & c & " Saved", vbInformation, "Saving Information..."
Att.Refresh
End If
Subscribe to:
Posts (Atom)