Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim str As String
Dim cmd As OleDb.OleDbCommand
Dim icount As Integer
Dim conn As OleDb.OleDbConnection
Try
conn = GetConnection()
conn.Open()
str = “insert into address values(” & CInt(TextBox1.Text) & “,’” & TextBox2.Text & “‘,’” & TextBox3.Text & “‘,’” & TextBox4.Text & “‘,’” & TextBox5.Text & “‘)”
’string stores the [...]
Archive for July, 2006
Insert Data in MSAccess (OleDb data Provider)
Posted in VB.NET, tagged vb.net on July 18, 2006 | 3 Comments »
Data Access using MSAccess (OleDb data Provider)
Posted in VB.NET, tagged vb.net on July 18, 2006 | Leave a Comment »
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim conn As OleDb.OleDbConnection = GetConnection()
Dim ds As New DataSet
Dim sql As String = “select * from address”
Dim da As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter(sql, conn)
da.Fill(ds, “address”)
DataGrid1.DataSource = ds.Tables(“address”)
End Sub
Public Function GetConnection() As OleDb.OleDbConnection
‘return a new connection to the database
Return New OleDb.OleDbConnection(“Provider=Microsoft.Jet.OleDb.4.0;data source=C:test.mdb;”)
End Function
read text file in vb.net
Posted in VB.NET, tagged vb.net on July 17, 2006 | 5 Comments »
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
Dim LineIn As String
oRead = oFile.OpenText(“C:sample.txt”)
While oRead.Peek -1
LineIn &= oRead.ReadLine()
End While
RichTextBox1.Text = LineIn
oRead.Close()
read a text file in vb.net
Posted in VB.NET, tagged vb.net on July 17, 2006 | Leave a Comment »
Dim oFile As System.IO.File
Dim oRead As System.IO.StreamReader
Dim LineIn As String
oRead = oFile.OpenText(“C:sample.txt”)
While oRead.Peek <> -1
LineIn &= oRead.ReadLine()
End While
RichTextBox1.Text = LineIn
oRead.Close()
write text file in vb.net
Posted in VB.NET, tagged vb.net on July 17, 2006 | 2 Comments »
Dim oFile As System.IO.File
Dim oWrite As System.IO.StreamWriter
oWrite = oFile.CreateText(“C:sample.txt”)
oWrite.WriteLine(“Write a line to the file”)
oWrite.WriteLine()
oWrite.Close()
some codes to write in header and footer of printing
Posted in General, tagged General on July 17, 2006 | Leave a Comment »
Sometime wee need to print page number, total no of pages, page location ect. in our printing page. There are commands to write such important things.
CODE
DESCRIPTION
PREVIEW
&w
Window Title
Print window title &w
&u
Page Address
http://www.yahoo.com
&d
Date in Short Format
7/17/2006
&D
Date in Long format
Monday. July 17, 2006
&t
time
1:14:03 PM
&T
Time in 24 hour format
23:14:03 PM
&p
Current Page number
Page number &p
&P
Total Number of Pages
Total no of [...]
write file in vb.net
Posted in VB.NET, tagged vb.net on July 16, 2006 | Leave a Comment »
Dim fs As New FileStream (“test.txt”, FileMode.Create, FileAccess.Write)
Dim s As New StreamWriter(fs)
Dim length As Integer
s.BaseStream.Seek(0, SeekOrigin.End)
s.WriteLine(“This example of using file handling concepts in VB .NET.”)
s.WriteLine(“This concept is interesting.”)
s.Close()
read file in vb.net
Posted in VB.NET, tagged vb.net on July 16, 2006 | Leave a Comment »
Dim fs As New FileStream (“test.txt”, FileMode.Open, FileAccess.Read)
Dim d As New StreamReader(fs)
d.BaseStream.Seek(0, SeekOrigin.Begin)
While d.Peek() > -1
RichTextBox1.Text &= d.ReadLine()
End While
d.Close()
print a datagrid
Posted in VB.NET, tagged C#.net, datagrid on July 6, 2006 | 3 Comments »
<html>
<head>
<title>Data Grid print test</title>
<script language=”javascript” type=”text/javascript”>
function showReport()
{
var divGrid = document.getElementById( ‘divGrid’ );
if( divGrid.innerHTML != ” )
window.open( ”, ” ).document.write( divGrid.innerHTML + ‘<input type=”button” onclick=”window.print();” value=”Print”>’ );
}
</script>
</head>
<body>
<div id=”divGrid”>
”put your datagrid here to test
</div>
<input type=”button” value=”Click me” onclick=”showReport();” />
</body>
</html>

