Monday, April 23, 2012

How to connect to MS- Access in VB.net


Dim conn As New OleDb.OleDbConnection
         conn.ConnectionString = " Provider=Microsoft.Jet.OLEDB.4.0;Data Source=Love.mdb"
        Try
             conn.Open()

        Catch ex As Exception
            MessageBox.Show(ex.Message, "connection to access failed")

        End Try
 Dim comm As New OleDb.OleDbCommand

  comm.CommandText = "delete from customer where ID = " & TextBox1.Text

         comm.Connection = conn

        If  comm.ExecuteNonQuery() = 1 Then
            MessageBox.Show("Successful")
        End If


         comm.CommandText = "select ID from customer where contact = '" & TextBox3.Text & "'"
         comm.Connection = conn

        Dim dr As OleDb.OleDbDataReader =  comm.ExecuteReader()

        If dr.HasRows Then
            Do While dr.Read()
                MessageBox.Show("The Customer id is " & dr("ID"))
            Loop

        End If


       conn.Close()


Monday, January 2, 2012

How to share internet connection over network


Go to My Computer > right-click and choose Manage
Double click "Services and Applications"
Double click "Services"
Scroll down to "Internet Connection Sharing" and double-click on it
On the "General" tab, set the Startup Type to "Automatic"
Click "Apply"
Click the "Recovery" tab
Click the "Subsequent Failures" button and select "Restart the Service"
Ensure that "Restart service after" is set to 0 minutes
OK out and close Computer Management
You should have the sharing tab now on the Properties of your network connection. In that tab go Just click the checkbox on share your internet connection over the network and you are done.

Monday, November 28, 2011

How to make VLC video as desktop background

Hi guys today i was searching for how to make a VLC video as your desktop background. Its very easy just few simple steps and your are done.

Note: - If you are using windows 7. And you wallpaper changes after a certain period of time just disable it so as  to run the video as your wallpaper.

Now the process of making the video as wallpaper is
1. Open VLC media player. And press Ctrl + P. It will open preferences.

2. Go to Video tab in the preferences. And there change the setting of output from DEFAULT to DirectX video output.As shown in fig.

3. Now restart your VLC and right click on the VLC screen go into video menu and click on DirectX Wallpaper. Your video is now running as your desktop background . Enjoy.


One more thing i forgot to tell. Whenever you want to remove the video from your background just refresh your screen and you are done.                                                                                     

Thursday, November 17, 2011

Using sleep in dev cpp

Sometime we require a screen to stay for a while and moreover we don't want to use key pressing to move, we just want to use the concept of sleep for a while then its quite easy in dev we just need to write the code :


#include <time.h>
 
time_t now, later;
 
void sleep(int delay)
{
 now=time(NULL);
 later=now+delay;
 while(now<=later)now=time(NULL);
}
 

"TIME.H" comes pre installed with dev cpp. So need not worry about it.

Wherever you want ot use sleep now just call

sleep(2);
here 2 denotes the number of seconds it will sleep for. Keep in mind its seconds not milliseconds.
Now a screen can stay and move whenever you want without using keyboard.

Wednesday, November 16, 2011

Running C / C++ in Ubuntu


  1. Install the build-essential package by typing the following command in the terminalsudo apt-get install build-essential
  2. Now create a file that has the extension .c (if you plan to write a C program) or .cpp (for a C++ program).
  3. Write the code in that file.
  4. Now open a terminal and go to the place where you saved that file using the cd command (e.g. cd Desktop).
  5. If you have a C program type in the terminal 
    • gcc -Wall -W -Werror hello.c -o hello.c
    • The first line will invoke the GNU C compiler to compile the file hello.c and output (-o) it to an executable called hello.
    • The options -Wall -W and -Werror instruct the compiler to check for warnings.
    • If you have a C++ program simply replace gcc with g++ and hello.c with hello.cpp. The options do the same things.
    • If you get a permissions error, you need to make the file executable. You can do this with chmod +x hello.cpp
    • Now type in the terminal ./hello and the program will run.

    Tuesday, November 15, 2011

    Installing Wine on Ubuntu

    Type sudo apt-get install wine on the terminal. It will download the whole package required for wine and then it will install it.
    Next you need to change every exe to executable using the command on the terminal chmod 755 ~/Downloads/INSTALL.EXE. ~/Downloads/ denote the path and INSTALL.EXE is the name of the file.
    Now to run the exe using wine just type wine ~/Downloads/INSTALL.EXE on the terminal it will execute the required exe on your system.