Showing posts with label Client Server Application. Show all posts
Showing posts with label Client Server Application. Show all posts

Saturday, January 29, 2011

IP addresses of famous websites…….


IP addresses of famous websites…….

1.       Google.com  -  209.85.231.104 

2.       Microsoft.com –  207.46.170.123

3.       Yahoo.com - 72.30.2.43

4.       Facebook.com - 66.220.149.25

5.       Wikipedia.com - 208.80.152.2

6.       Dell.com - 143.166.83.38

7.       Twitter.com - 128.242.245.116



To find the ip addresses of websites....

1. Goto RUN (Press WINDOW KEY + R)

2. TYPE cmd

3. In the command prompt...
                                                     write ping [url of website]

                                                                      ex: ping www.google.com

Friday, January 21, 2011

Next, Previoust......Button Coding in VB.NET

First Declare two variables n and mx.............

Dim n As Integer = 0
    Dim mx As Integer

Make one function for moving........

Public Sub next1()

        TextBox1.Text = ds.Tables(0).Rows(n).Item(0).ToString
        TextBox2.Text = ds.Tables(0).Rows(n).Item(1).ToString
        TextBox3.Text = ds.Tables(0).Rows(n).Item(2).ToString

    End Sub







Here, it will show 'n' th row's data and for first record n = 0 and for last data n = mx -1

MX means maximum data but data start indexing start with 0 so last data is n= mx-1


For first button........

Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        cn.Open()
        n = 0

        next1()


        cn.Close()

    End Sub


For Last Button....

 Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        cn.Open()
        mx = ds.Tables(0).Rows.Count
        n = mx - 1
        next1()

        cn.Close()


    End Sub

For Next Button.......

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        cn.Open()
        mx = ds.Tables(0).Rows.Count
        If (n <> mx - 1) Then
            n = n + 1
            next1()

        Else
            MsgBox("This is your last data")

        End If

        cn.Close()

    End Sub


For Previous Data............

 Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        cn.Open()
        mx = ds.Tables(0).Rows.Count
        If (n <> 0) Then
            n = n - 1
            next1()

        Else
            MsgBox("This is your first data")

        End If
        cn.Close()

    End Sub

Thursday, January 20, 2011

OLEDB Coding for Techno Stuff Readers

Sorry Friends for being late but its beneficial to revise again...................
Specially Sandeep for YOU......: )

Create one database named emp and make one table emp which contains three coulmns like
id = datatype autonumeric
Name = TEXT
City= TEXT

First of all we have to imports the data and oledb in our coding section
Imports System.Data
Imports System.Data.OleDb

Then we have to declare connection object and dataset in global declaration area because we will need it in many private events like button's click event......

Dim cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\emp.mdb") 

Dim ds As New DataSet 

Now place four textbox, eight buttons and one data-grid-view on design portion......

Now make one function which works for select query.........

Public Sub selectQuery()
        'We made one function for select query and will use it in every place where select query needed


        Dim adp As New OleDbDataAdapter("Select * from emp", cn)
        ds.Clear()
        adp.Fill(ds)


        DataGridView1.DataSource = ds.Tables(0)

    End Sub


First code for Inserting Data.......Double Click On Insert Button.........


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

        Dim cmd As New OleDbCommand("insert into emp (Name, City) values ('" &TextBox1.Text &"', '"& TextBox2.Text &"') ", cn)
        'we inserted data from textbox into emp table, we didnt included id because it's datatype is autonumeric

        cmd.ExecuteNonQuery()

        MsgBox("Data Inserted Successfully", MsgBoxStyle.Information, vbOK)

        selectQuery()

        DataGridView1.DataSource = ds.Tables(0)

        cn.Close()

    End Sub

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

        Dim cmd As New OleDbCommand("Delete * from emp where id = " & TextBox1.Text & " ", cn)
        cmd.ExecuteNonQuery()

        selectQuery()

        cn.Close()
    End Sub

 

Update Query...............

 Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        cn.Open()

        Dim cmd As New OleDbCommand("update emp set Name='" & TextBox2.Text & "' where id = " & TextBox1.Text & " ", cn)

        cmd.ExecuteNonQuery()

        selectQuery()


        cn.Close()

    End Sub



Search Button Coding......................

You can search from database by two way. We will see first method double click on search button.
and write below code.

  Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        cn.Open()

        Dim adp As New OleDbDataAdapter("Select * from emp where name='" & TextBox4.Text & "' ", cn)
        ds.Clear()
        adp.Fill(ds)

        DataGridView1.DataSource = ds.Tables(0)
        cn.Close()

    End Sub




Search with Text Changed Event.......
 
 Private Sub TextBox4_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox4.TextChanged
        cn.Open()

        Dim adp As New OleDbDataAdapter("Select * from emp where City like '" & TextBox4.Text & "%' ", cn)
        ds.Clear()
        adp.Fill(ds)

        DataGridView1.DataSource = ds.Tables(0)
        cn.Close()
    End Sub

We will see next, previous and last button coding in next article till then enjoy and read Technology Stuff at Present 2 Upcoming

Wednesday, January 19, 2011

Select Query

 Design:


Imports System.Data
Imports System.Data.OleDb


Public Class Form1

    Dim cn As New OleDbConnection("Provider=Microsoft.Jet.Oledb.4.0;Data Source=C:\Users\Maulik Dave\Documents\loginform.mdb")


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

        Dim adp As New OleDbDataAdapter("Select * from tablogin where username= '" & TextBox1.Text & "' and password='" & TextBox2.Text & "' ", cn)
        Dim ds As New DataSet

        adp.Fill(ds)

        If (ds.Tables(0).Rows.Count > 0) Then

            Me.Hide()
            signup.Show()

        Else

            MsgBox("Program Failed")

        End If



        cn.Close()

    End Sub

End Class

Wednesday, November 24, 2010

File Handling (StreamReader and StreamWriter)

" Before the coding procedure, you have to place 2 buttons and 1 Richtextbox in the form. "



Public Class Form1

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

        If (System.IO.File.Exists("F:\MyProgram.c")) Then

            Dim a As New System.IO.StreamReader("F:\MyProgram.c")
            Dim b As String

            If (RichTextBox1.Text = "") Then
                b = a.ReadLine()

                Do Until b Is Nothing
                    RichTextBox1.Text = RichTextBox1.Text + b
                    b = a.ReadLine()
                Loop
              
            End If
            a.Close()

        Else

            MsgBox("This file does not exist, Plz write in RTB")

        End If

    End Sub



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

        Dim c As New System.IO.StreamWriter("F:\MyProgram.c")
        Dim d As String

        c.WriteLine(RichTextBox1.Text)
        c.Close()

    End Sub

End Class

Tuesday, November 23, 2010

File Handling (Basic Program)



Public Class Form1

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

        Dim i As New System.IO.StreamWriter("D:\first_file.doc")
        i.WriteLine("Hello World")
        i.WriteLine("My Name is Maulik")
        i.Close()


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

        Dim j As New System.IO.StreamWriter("D:\new.ppt")
        j.Write("Maulik A")
        j.WriteLine(" Dave")
        j.WriteLine("Roll No 009")
        j.Close()

    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

        Dim k As New System.IO.StreamReader("D:\new.ppt")
        MsgBox(k.ReadToEnd())


    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

        Dim l As New System.IO.StreamReader("D:\first_file.doc")


        Dim s As String = l.ReadLine()

        Do Until s Is Nothing
            ListBox1.Items.Add(s)
            s = l.ReadLine()
        Loop
        l.Close()

    End Sub
End Class