Saturday, 12 October 2013

Print the result value in the TEXT BOX instead of MESSAGE BOX

Sample program:

1. Place the TEXT BOX and a BUTTON on FORM.
2. Change the button name into ADD 2 NUMBERS.

3.Then double click on button is show the code of the form.
 then type the below code.
        Dim var1 As Integer
        Dim var2 As Integer
        Dim result As Integer

        var1 = 10
        var2 = 15

        result = var1 + var2
        TextBox1.Text = result         
Type the yellow marked code instead of  MsgBox(result)






  <---- Previous page                                Next page ---->

VB.NET HOME PAGE

Sample Program

Example program:

     First add a BUTTON to the FORM As Shown above.
     Select the button and then go to Property window and change the button name as ADD 2 NUMBERS.

     how to change the name of the button?
     refer this link.
        
            To get our first look at the code window, double click your Button control. The code 
      window will appear.




As shown in the above figure we need to write our code where the cursor blinks.. here we need to concentrate on our code for our program. The cursor will be blinks in between Private sub and End sub.

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

                     
Private
Private means that no other part of the program can see this code except for our button.
Sub
Short for Subroutine. The "Sub" word tells VB that some code follows, and that it needs to be executed.
Button1
This is the name of our button. You might think that we've just erased the word "Button1" when we changed the Text property, so why does VB insist that it's still called Button1? We'll, the Name property of the control is the important one. If you change the Name property, VB will change this button name for you.
_Click ( )
This is something called an Event. In other words, when the button is clicked, the Click Event will fire, and the code we're going to write will be executed.
End Sub
The subroutine ends right here. This signifies the end of our code.

Now we are going to write our code in between Private sub and end sub.


        Dim var1 As Integer
        Dim var2 As Integer
        Dim result As Integer
      
        var1 = 13
        var2 = 15
       
        result = var1 + var2
        MsgBox(result)



Then save our project and then run it.
Goto debug menu ----> start Debugging.
Then click on button.
Then the result will be displayed in MESSAGE BOX.



                                             

<---- Previous page                                                 Next Page ---->

VB.NET HOME PAGE

Friday, 11 October 2013

Dealing with variables in VB.NET.

How to create variables in VB.NET?              

                With Visual Basic, and most programming languages, what you are doing is storing things in the computer's memory, and manipulating this store. If you want to add two numbers together, you put the numbers into storage areas and "tell" Visual Basic to add them up. But we can't do this without variables.

For ex:


Dim var1 As Integer
Dim var2 As Integer

var1= 10
var2= 15

This code is used to setting up the variables in the VB.NET.
Dim
Short for Dimension. It's a type of variable. we declared  that we  are setting up a variable with this word. We'll meet other types of variables later.
var1
This is a variable. In other words, our storage area. After the Dim word, Visual Basic is looking for the name of our variable. we can call our variable almost anything you like such num1, x, y and so on. But there are a few reserved words that VB won't allow.
As Integer
We're telling Visual Basic that the variable is going to be a number (integer). Well meet alternatives to Integer later.
var1 = 10
The equals sign is not actually an equals sign. The = sign means assign a value of. In other words, here is where you put something in your variable. We're telling Visual Basic to assign a value of 10 to the variable called varr1. 


<---- Previous page                        Next page ---->

VB.NET HOME PAGE


Change the Background color of the Form

How to change the background color of  the Form?

  •  First select the Form by mouse left click on it.
  •  Then move to Property window.
  •  Select Back color. By default it has system colors nothing but "control".
  •  From there we can select the other colors as we like.

Now we will have a look that shows the form background color:


Before changing (Default):


After changing:



For FORM Back Color we have 3 different types of colors:
 They are:   
  •  CUSTOM
  •  WEB
  •  SYSTEM
 Custom colors:


Web colors:


System colors:






<----Previous page                                          Next page ---->


VB.NET HOME PAGE

Thursday, 10 October 2013

Properties of tools...........



                               Right side of the Design environment we the PROPERTY BOX for everything like form, labels, textboxes, buttons etc.. in the design area. If it does not appears jst goto
VIEW menu ---> other windows ---> then select Properties window.



If your Properties box says "Textbox1 Textbox" or "Label1 Label" then you haven't yet selected the Form. Click away from the textbox or label until the Properties box reads "Form1 Form".

The property box has different properties such as: font , background image, background image layout, cursor etc..

If we want to change the name of the FORM jst put the cursor on the form goto properties and the select "AZ grid" which is nothing but alphabet grid on the top of the property box.

 Then goto TEXT by scrolling down to the property box.

Then change the name FORM1 by new name like "My New Form".
IT looks like:

Before changing :

After changing:





<---- Previous page                                                         Next page ---->


VB.NET HOME PAGE

Wednesday, 9 October 2013

Adding Controls To Form Using Tool box

Adding controls to form:
      We can add controls or tools to our form such as labels, text boxes, buttons and so on...


how to add labels to a form?

1. First open tool box and select label then move to form then drag and drop the mouse with left click.
2. Then we add the label to the form.
3. In this way we can add more labels as per our requirement.
How to add text box to a form?

1. First open tool box and select TextBox then move to form then drag and drop the mouse with left click.
2. Then we add the TextBox to the form.
3. In this way we can add more TextBoxes as per our requirement.


         In this manner we can add other controls too..
         we will observe them in later sections...

How to add Button to a form?

1. First open tool box and select BUTTON then move to form then drag and drop the mouse with left click.
2. Then we add the BUTTON to the form.
3. In this way we can add more BUTTONS as per our requirement.

                                                        (or)

Just double click on any control . It will directly placed on the form Top-Left corner.
We can place it wherever we want.



     

<---- Previous page                                               Next page ---->


VB.NET HOME PAGE

Tuesday, 8 October 2013

How to access Visual basic Express 2010New Project

New Project:


how to take a new project in visual basic?

1. Goto start---> open Microsoft Visual Basic Express 2010
2. click on new project.
     Its looks like

3. Then click on Windows Forms Application. Then click ok


It displays a new form. working area.

4.Beside form on the lift side we have tool box to use different tools for form creation.
5.If not appeared goto Menu bar ----> Click on VIEW menu ----> goto other windows ----> select Tool box.
                                                                     (or)
jst click Ctrl+Alt+x.


6. To run the  form goto Debug menu----> click on start  debugging.
 It runs our form..




        <---- Previous page                                               Next page ---->


VB.NET HOME PAGE

VB.NET basics

       VB.Net is a simple, modern, object-oriented computer programming language developed by Microsoft to combine the power of .NET Framework and the common language runtime with the productivity benefits that are the hallmark of Visual Basic.

The .Net Framework
The .Net framework is a revolutionary platform that helps you to write the following types of applications:

  •          Windows applications
  •          Web applications
  •          Web services

Integrated Development Environment (IDE) For VB.Net


Microsoft provides the following development tools for VB.Net programming:

After installing the visual Basic Express 2010 software it looks like:




   <----Previous page                        Next page  ---->



VB.NET HOME PAGE




Thursday, 13 June 2013

Multi touch Technology

MULTI TOUCH TECHNOLOGY

ABSTRACT

            When interacting with a regular desktop computer, indirect devices such as a mouse or keyboard are used to control the computer. Results of the interaction are displayed on a monitor. Current operating systems are restricted to one pointing device. With the introduction of multi-touch, a new form of human computer interaction is introduced. Multi-touch combines display technology with sensors which are capable of tracking multiple points of input. The idea is that this would allow users to interact with the computer in a natural way.

            Multi-touch consists of a touch screen (screen, table, wall, etc.) or touchpad, as well as a software that recognizes multiple simultaneous touch points, as opposed to the standard touch screen which recognizes only one touch point at a time. Multi touch using Frustrated Total Internal Reflection is a simple, inexpensive, and scalable technique for enabling high-resolution multi- touch sensing on rear-projected interactive surfaces. Different  applications for multi-touch interfaces both exist and are being proposed.  Some uses are individualistic eg iPhone, iPod touch, MacBook Pro, MacBook Air. The use of multi-touch technology is expected to rapidly become common place.


PDF Document
WORD Document
PPT Downloads

Tuesday, 11 June 2013

Analog clock

CPP program to display analaog clock:

#include<conio.h>
#include<graphics.h>
#include<dos.h>
#include<process.h>
#include<iostream.h>

int calculatehrs(int h)
{
 int x;
 switch(h)
 {
  case 0: x=90;
   break;
  case 1:
  case 13: x=60;
    break;
  case 2:
  case 14: x=30;
    break;
  case 3:
  case 15: x=0;
    break;
  case 4:
  case 16: x=330;
    break;
  case 5:
  case 17: x=300;
    break;
  case 6:
  case 18: x=270;
    break;
  case 7:
  case 19: x=240;
    break;
  case 8:
  case 20: x=210;
    break;
  case 9:
  case 21: x=180;
    break;
  case 10:
  case 22: x=150;
    break;
  case 11:
  case 23: x=120;
    break;
  case 12:
  case 24: x=90;
   break;
 }
 return(x);
}

int calculatemin(int m)
{
 int x;
 if(m%5==0)
 {
  switch(m)
  {
   case 0: x=90;
    break;
   case 5: x=60;
    break;
   case 10: x=30;
     break;
   case 15: x=360;
     break;
   case 20: x=330;
     break;
   case 25: x=300;
     break;
   case 30: x=270;
     break;
   case 35: x=240;
     break;
   case 40: x=210;
     break;
   case 45: x=180;
     break;
   case 50: x=150;
     break;
   case 55: x=120;
     break;
   case 60: x=90;
     break;
  }
 }
 else
 {
  if(m>0&&m<15)
  {
   switch(m)
   {
    case 1: x=84;
     break;
    case 2: x=78;
     break;
    case 3: x=72;
     break;
    case 4: x=66;
     break;
    case 6: x=54;
     break;
    case 7: x=48;
     break;
    case 8: x=42;
     break;
    case 9: x=36;
     break;
    case 11: x=24;
      break;
    case 12: x=18;
      break;
    case 13: x=12;
      break;
    case 14: x=6;
      break;
   }
  }

   if(m>15&&m<30)
  {
   switch(m)
   {
    case 16: x=354;
      break;
    case 17: x=348;
      break;
    case 18: x=342;
      break;
    case 19: x=336;
      break;
    case 21: x=324;
      break;
    case 22: x=318;
      break;
    case 23: x=312;
      break;
    case 24: x=306;
      break;
    case 26: x=294;
      break;
    case 27: x=288;
      break;
    case 28: x=282;
      break;
    case 29: x=276;
      break;
   }
  }

   if(m>30&&m<45)
  {
   switch(m)
   {
    case 31: x=264;
      break;
    case 32: x=258;
      break;
    case 33: x=252;
      break;
    case 34: x=246;
      break;
    case 36: x=234;
      break;
    case 37: x=228;
      break;
    case 38: x=222;
      break;
    case 39: x=216;
      break;
    case 41: x=204;
      break;
    case 42: x=198;
      break;
    case 43: x=192;
      break;
    case 44: x=186;
      break;
   }
  }

   if(m>45&&m<60)
  {
   switch(m)
   {
    case 46: x=174;
      break;
    case 47: x=168;
      break;
    case 48: x=162;
      break;
    case 49: x=156;
      break;
    case 51: x=144;
      break;
    case 52: x=138;
      break;
    case 53: x=132;
      break;
    case 54: x=126;
      break;
    case 56: x=114;
      break;
    case 57: x=108;
      break;
    case 58: x=102;
      break;
    case 59: x=96;
      break;

    }
  }

  }
 return(x);
}

int changehrs(int m,int a)
{
 if(m>15&&m<=30)
  a-=12;
 if(m>30&&m<=45)
  a-=18;
 if(m>45&&m<60)
  a-=24;
 return (a);
}

void main()
{
 int gdriver=DETECT,gmode,h,m,s,a,b,c;
 initgraph(&gdriver,&gmode,"c:\\tc\\bgi");

 struct  time t;
 gettime(&t);
 h=t.ti_hour;
 m=t.ti_min;
 s=t.ti_sec;

  a=calculatehrs(h);
 b=calculatemin(m);
 c=calculatemin(s);
 a=changehrs(m,a);

 for(int i=a;i>0;i-=6)
  for(int j=b;j>0;j-=6)
  for(int k=c;k>0;k-=6)
  {
   setbkcolor(7);
   settextstyle(1,HORIZ_DIR,5);
   setcolor(BLUE);
   outtextxy(190,20,"Analog Clock");
   settextstyle(8,HORIZ_DIR,2);

    setcolor(BLUE);
   circle(300,200,102);
   setcolor(YELLOW);
   circle(300,200,100);
   outtextxy(385,185,"3");
   outtextxy(288,98,"12");
   outtextxy(207,185,"9");
   outtextxy(295,270,"6");

    circle(345,123,2);
   circle(378,155,2);
   circle(378,245,2);
   circle(345,280,2);
   circle(253,278,2);
   circle(223,245,2);
   circle(223,155,2);
   circle(253,123,2);

    setcolor(RED);
   pieslice(300,200,i-1,i,75);
   setcolor(WHITE);
   pieslice(300,200,j-1,j,85);

    setcolor(BLUE);
   pieslice(300,200,k-1,k,95);

    setcolor(RED);
   settextstyle(3,HORIZ_DIR,1);
   outtextxy(360,400,"Press any key to exit...!!");
   sleep(1);
   clearviewport();

    if(i==6)
    a=360;
   if(j==6)
    b=360;
   if(k==6)
    c=360;

    if(kbhit())
   {
    setcolor(BLUE);
    setbkcolor(WHITE);
    settextstyle(1,HORIZ_DIR,8);
    outtextxy(130,150,"Thank You");
    sleep(3);
    exit(0);
   }

   }
}


Error:
after save the program we can compile it and we can run it by pressing the keys alt+f9(compile) and ctrl+f9(running) respectively.

while compiling and running it wont give any error.
but it flickers the screen and then terminates it.
when we press the keys alt+f5 it prints the BGI error
to recctify the error we must copy the "EGAVGA.BGI" file from BGI foder into the current folder where we save our program.
steps to goto BGI folder:
start---> my computer---> local disk(C)--->turbo c++--->Disk--->turboc3--->
BGi folder--->EGAVGA.BGI.
again save the program and then compile and run it
then we willl get the analog clock as output.


output: