Question

In Visual Studio, create a program that provides the following items: 1 Textbox control 2 Picturebox...

In Visual Studio, create a program that provides the following items:

1 Textbox control
2 Picturebox control
3 int datatype
4 double datatype
5 strings
6 comment each line of code that you put into the form1.cs
7

label control

8

button control

The program can be about anything you want. It should be a functional program.

Program Items worth (40pts (5pts per item) )

Creativity of your program worth (30pts)

Functionality worth (30pts)

Submit your (form cs file) and the screenshot of the output of your program.

Homework Answers

Answer #1

1.TEXBOX CONTROL

The text box is the standard control for accepting input from the user as well as to display the output. It can handle string (text) and numeric data but not images or pictures. A string entered into a text box can be converted to a numeric data by using the function Val(text). The following example illustrates a simple program that processes the input from the user.

CODE:

Private Sub Command1_Click()
'To add the values in TextBox1 and TextBox2
  Sum = Val(Text1.Text) +Val(Text2.Text)
'To display the answer on label 1
  Label1.Caption = Sum
End Sub

OUTPUT :

2.PICTURE BOX CONTROL

The Picture Box is one of the controls that is used to handle graphics. You can load a picture at design phase by clicking on the picture item in the properties window and select the picture from the selected folder. You can also load the picture at runtime using the LoadPicture method. For example, the statement will load the picture grape.gif into the picture box.

Picture1.Picture=LoadPicture ("C:\VBprogram\Images\grape.gif")

CODE :

Private Sub cmd_LoadPic_Click()
MyPicture.Picture = LoadPicture("C:\Users\admin.DESKTOP-NGDHD\Documents\My site\skdgd\vb6\images\sjdhsw.jpg")
End Sub

OUTPUT :

3.DATATYES(INT,DOUBLE,STRINGS)

In Visual Basic, Data Types are useful to define a type of data the variable can hold such as integer, float, string, etc. in our application.

Visual Basic is a Strongly Typed programming language so before we perform any operation on a variable, it’s mandatory to define a variable with a required data type to indicate what type of data the variable can hold in our application.

CODE :

Module Module1

    Sub Main()

        Dim id As Integer

        Dim name As String = "Suresh Dasari"

        Dim percentage As Double = 10.23

        Dim gender As Char = "M"c

        Dim isVerified As Boolean

        id = 10

        isVerified = True

        Console.WriteLine("Id:{0}", id)

        Console.WriteLine("Name:{0}", name)

        Console.WriteLine("Percentage:{0}", percentage)

        Console.WriteLine("Gender:{0}", gender)

        Console.WriteLine("Verfied:{0}", isVerified)

        Console.ReadLine()

    End Sub

End Module

OUTPUT :

Id:10

Name:Suresh Dasari

Percentage:10.23

Gender:M

Verfied:True

7.LABEL CONTROL

The label is a very useful for control the Visual Basic, as it is not only used to provide instructions and guides to the users, it can also be used to display the outputs. One of its most important properties is Caption. Using the syntax Label.Caption, it can display text and numeric data . You can change its caption in the properties window and also at runtime.

8.BUTTON CONTROL

The command button is one of the most important controls as it is used to execute commands. It displays an illusion that the button is pressed when the user click on it. The most common event associated with the command button is the Click event, and the syntax for the procedure is

Private Sub Command1_Click ()
 Statements
End Sub

CODE :

Private Sub cmd_ShowPass_Click()
 Dim yourpassword As String
 yourpassword = Txt_Password.Text
 MsgBox ("Your password is: " & yourpassword)
End Sub

OUTPUT :

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions