Pages

Friday, 31 August 2012

Don't Do it

This program will act as virus because it stop your computer working until you  restart your computer.This is power of DOS batch file
  1. start
  2. start.bat
Save this file with start.bat name and run...
and give me your feedback I'm waiting

Tuesday, 28 August 2012

Java Package


Hi there......
Java provides a mechanism for partitioning the class name space into more manageable chunks. This mechanism is the package. The package is both a naming and a visibility control mechanism. You can define classes inside a package that are not accessible by code outside that package.
To create a package is quite easy: simply include a package command as the first
statement in a Java source file. Any classes declared within that file will belong to the
specified package. The package statement defines a name space in which classes are
stored. If you omit the package statement, the class names are put into the default
package, which has no name.
  • Package name must be saved in same name folder
  • One package can comprise more than one class
  • Java source code and class should be saved in same folder as package name
  • One Java source file can include only one public class
  • For make more than one class in same package every java source file must be saved in separate file
  •  Java source file class should be public visibility otherwise class'll not be available for outside of package
package demo;
public class Myclass
{
        public void show()
        {
              System.out.println("Package function");
        }

when you will compile this file then it will create a class file named Myclass  you  must save this file in demo  named folder.Ones everything gos ok then you are ready to use this file.. consider following code where i am using this...
import demo.Myclass ;
//import demo.*;   for import all class in demo package
class MainFile
{
      public static void main(String args[])
      {
             Myclass ob=new Myclass();
             ob.show();
       }
}

A package can be nested like java.awt.event as i discussed above that every package should be save in same name folder so you will have to a folder in your current folder named as you want for package

package demo.demo2;
public class Myclass
{
       public void show()
       {
             System.out.println("Function from demo 2 package");
        }
}

You must make a folder named demo2 in demo folder.You can make more nested package as you want you just have make a folder.When user will use such package they'll have to provide all heir achy of package in this case it will be
import demo.demo2.*;
class packdemo
{
    public void show()
    {
         System.out.println("Nested package function");
     }
}
  • When you save this package in Bin folder then you can use (javac) for compile
  • If your package folder is outside of bin folder then you can use ( javac -classpath <java sourcefile>)
  • -classspath will search your package class file

Thursday, 23 August 2012

Make a numeric Text Box In VB.net and C#

hi...........
Most of the time we want to a text box which can only take numeric value such as textbox design for taking input of age and we know age must be a number.Textbox is a control which takes string values by default for change its functionality follow instruction....
Key events occur in the following order:
  1. KeyDown
  2. KeyPress
  3. KeyUp
To handle keyboard events only at the form level and not enable other controls to receive keyboard events, set the KeyPressEventArgs..::.Handled property in your form's KeyPress event-handling method to true. Certain keys, such as the TAB, RETURN, ESCAPE, and arrow keys are handled by controls automatically. To have these keys raise the KeyDown event, you must override the IsInputKey method in each control on your form. The code for the override of the IsInputKey would need to determine if one of the special keys is pressed and return a value of true.

VB.Net


Wednesday, 1 August 2012

How to Show Power Point Slide Show in Visual Basic

There are many way to show a power point slide show in vb form one can use OLE or a frame window
I'm showing it in a separate window. to show presentation do following steps

Make some declaration in general section 

  • Public oPPTApp As Object          
  • Public oPPTPres As Object
  • Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
          (ByVal lpClassName As String, _
           ByVal lpWindowName As Long) As Long
  • Private Declare Function SetWindowText Lib "user32" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long

Function for show presentation

Private Sub slideShow() 
    Dim screenClasshWnd As Long
    Set oPPTApp = CreateObject("PowerPoint.Application")
    If Not oPPTApp Is Nothing Then
            Set oPPTPres = oPPTApp.Presentations.Open("Paste Your Presentation file path", , , False)
         If Not oPPTPres Is Nothing Then
             With oPPTPres                  
                          With .SlideShowSettings
                                 .ShowType = 1000
                                 .Run
                        End With
                Call SetWindowText(FindWindow("screenClass", 0&), APP_NAME)
        
        End With
       Else
        MsgBox "Error : Could not open the presentation.", vbCritical, APP_NAME
    End If
Else
    MsgBox "Could not instantiate PowerPoint.", vbCritical, APP_NAME
End If
End Sub