Feeds:
Posts
Comments

Archive for July, 2006

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 [...]

Read Full Post »

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 Full Post »

read text file in vb.net

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 Full Post »

read a text file in vb.net

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 Full Post »

write text file in vb.net

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()

Read Full Post »

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 [...]

Read Full Post »

write file in vb.net

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 Full Post »

read file in vb.net

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()

Read Full Post »

print a datagrid

<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>

Read Full Post »