Hamid

   
 
  CS-65
Course Code : CS-65
Course Title : Windows Programming
Assignment Number : BCA (4)-65/Assignment/ 2008
Maximum Marks : 25
Last Date of Submission : 30th April, 2008/30th October, 2008



Question : 1 Explain Visual Basic development environment. Also discuss the basic programme structure in Visual Basic.

Ans :
The visual basic IDE has three distinct states :
            - Design
            - Run
            - and Debug.

      The current state aapears in visual basics title bar. The IDE is composed of these parts :-
            - The menu bar
            - The tool bar
            - The project Explorer
            - The properties Window
            - The form layout Window
            - The toolbox.




Selecting IDE colors, fonts and font size.


      Basic Programming structure is much similar to other programming languages. Visual basic language supports a large number of programming constructs and elements and that languages is the foundation on which we will build our projects.

      How does Visual basic code look ?

Private sub command1_click()
Dim Str As Sting
Dim x,y,z As Integer
x=10
y=20
z=x+y
MsgBox "The Sum is "&x
End Sub

Private Sub Command1_Click()
Dim x,y,z As Integer
x=10
u=20
z=30
If x>y and x>z Then
MsgBox "x is greatest "
ElseIf y>x and y>z
MsgBox "y is greates "
Else
MsgBox "z is greatest"
End If
"declaring an array in VB
dim arr(5) an integer
End sub

      In the above example we shown how to declare a variable by using dim statement and intializing the value and print the messages and the value stored in vasriable by using MsgBox() function also shown the system of it conditionjal statement,. This is the basic programme structure in visual basic.



Question : 2 Explain the need of built-in functions in Visual Basic. List out the various built in functions that are available in the latest version.

Ans.
Functions/Procedures/Methods:- functions are collection of programming statement written under a block and execute as a single unit.

two types of function we have in VB.

1. System Defined:- system defined function are also known as premitive function which are already defined and exist in VB liabrary. we have to use them as per our

requirment and convinient and they are as follows:-

i). Conversion functions:- like cint(),val(),Asc(),chr(),cbool(),cdate() and so on.

ii). Date Functions :- now,time,date,datediff,math,day

iii). string functions:- strreverse,strcomp,instr,mid and so on.

these system defined functions are very use full for us in our programe we donot need to develop the logic again and again to that work.

2. User Defined:-which are defined by us .

i). sub procedure

ii). function procedure

iii). property procedure

Examples:-

 

Print Asc("a")

Dim i As Integer

i = Asc("a")

Print i

 

 

Print Chr(97)

 

 

Dim str1 As String

str1 = "10"

Dim no As Integer

no = Val(str1)

Print no

str1 = str(no)

Print str1

 

Dim sdate As String

sdate = "2 january, 1994"

Dim dt As Date

dt = CDate(sdate)

Print dt

 

Private Sub Command9_Click()

'Removing spaces in the string

 

Dim str As String

str = "         Bye          "

str = LTrim(str)

Print str

 

Print str

str = RTrim(str)

Print str

str = Trim(str)

Print str

 

 

 

 

'Comparing string

Dim str1 As String

Dim str2 As String

str1 = "HELLO"

str2 = "hello"

 

 'strcomp(<str1>,<str2>,<compare type>)

 

' -1 return str1 < str2

'  0 return str1 = str2

'  1 return str1 > str2

 

'<compare type>

    '0 for binary

    '1 for textual

   

Dim res As Integer

res = StrComp(str1, str2, 1)

Print res

res = StrComp(str1, str2, 0)

Print res

res = StrComp(str2, str1, 0)

Print res

 

 

'Reversing Strings

Dim strrev As String

strrev = "hello how are you"

strrev = StrReverse(strrev)

Print strrev

 

 

'Searching for a string within a string

 

 

Dim searched As String

Dim found As String

Dim startsearch As Integer

Dim comparetype As Integer

 

searched = "This is the good book"

found = "good"

startsearch = 1

comparetype = 1

 

Dim resu As Integer

resu = InStr(startsearch, searched, found, comparetype)

Print "The position=>" & resu

 

found = "good"

comparetype = 0

resu = InStr(startsearch, searched, found, comparetype)

Print resu

 

resu = InStr(searched, found)

Print resu

 

'0 for not found

'position no for found

 

 

 

 

'replace a part of the string

 

Dim strString As String

strString = "thank you"

Mid(strString, 1, 5) = "Oh My"

Print strString

Mid(strString, 7) = "God" '

Print strString

 

 

 

 

 

'changing the case

 

Dim ustr As String

Dim lstr As String

ustr = "HELLO"

lstr = "bye"

ustr = LCase(ustr)

'Print ustr

lstr = UCase(lstr)

'Print lstr

End Sub





Question : 3 Analyze the difference between Local, Module level, and Global Variable. Also explain how ActiveX DLLS are created.

Ans:- Local vaiables are local for the block in which it is defined means if we declare a variable in any function or procedure that variable can be used with that function or procedure block. It means that is local for that procedure or function. Module level variables are public and can be accessed any where with in the module block or that code which contains the object of the module. By making we can use the module data members. But if we make a variable global in a program, means if we declare the variable at the top of all the code that become the global variable for that perticular module or program and we can use that variable in any function or code of the program with out adding any refference. And if any function or code of the program with out adding any refference. And if any code will change the value of global variable that will reflect though out the complete program.

for example :-
in a for module

'global variable for whole program
dim ctr as integer
public sub Form_Load()
'local variable for the form_load procedure
dim x as integer
end sub

Creating Active X DLL's :-
      An activeX DLL is a code that runs in the same process as the client application. So it runs in the same address space as the client application that is using the componenet.
      Any componenets you create to work with Microsoft Transaction Server must be ActiveX DLL componenets. Any other components you develop for use on the same machine as the client application can also be ActiveX DLL componenets. This is normally the preferred choice because it is easier to test (by adding another project using the new VB5 project group feature) and has better performance.



Question : 4 Discuss what constitutes proper code writing conventions in Visual Basic. Also write code in Visual Basic to find square root of a given number.

Ans:- Microsoft has set up a number of conventions for programming visual basic including naming conventions. These conventions are not necessary if you program alone, but they can still be helpful.
1. Variable Scope Prefix :- if you have a global variable named ErrorCount, you can use the g Prifix to indicate that, that variable is a global variable.
2. Variable Pefix : - Variable names should be prefixed to indicate their data type.
example :- Boolean=bln and double=dbl
3. Control Prefix :- which control we are using in our project we have to use the control prefix accordingle like
for textbox, we use txt, label=lbl, richtextbox=rtf, combobox=cbo, listbox=lbx and so on.
4. Code commenting Conventions :- We should add a new comment when you declare a new and important variable or project.
For example,
1. Purpose :- what the purpose does
2. assumptions
3. effects
4. inputs
5. returns.

Program to find square root of any given number
Private Sub Command1_Click()
Dim x As Integer
x=InputBox("enter any number")
MsgBox Sqr(x)
End Sub



Question : 5 Explain the chart control and grid control in Visual Basic.

Ans :-
Chart control :-
Chart Control is the most use full and power full feature of vb 6.0 to display and presenet the data or information.
Inspite of displaying in text box we can display the data in the graphical and attractive format by using different types of chart like pie chart, 3d and 2d bar chart or line chart etc.

To add chart in vb6.0 follow the following steps.
1. Select the project/Component menu item.
2. Select the controls tab in the components box that opens.
3. Selent the microsoft chart control entry in the components box, and click on ok to close the components box.
4. Draw a new chart control on your form.
To select the type of chart you want, you set the chart controls chart type property
VtChChartType3dBar-3d bar chart
VtChChartType2dBar-2d bar chart
VtChChartType3dLine-3d Line chart
and so on.

Grid Control :-
Grid control in vb is a very most use full complex data bound control to display the data from multiple table at one time.
For that purpose we have the flex grid control vb6.0.
1. Select the project/Component menu items.
2. Click the controls tab in the components dialog box.
3. Select the MS Flex Grid control entry in the components dialog box.
4. Close the components dialog box by clicking on OK. This displays the Flex Grid Control tool.
5. Add a flex grid Control to your form in the usual way to visual basic controls, using the Flex Grid Control tool.
6. Set the flex grid's Rows and cols properties to the number of rows and cols you want in your flex grid. You can also customize your flex grid by setting such propertied as border styles, forcolor, backcolor.



Question : 6 Create a form where the user can enter their name into text box and have the name as output into a label in a different font and color.

Ans:-
Fig:-1



Private Sub Command1_Click()
Label2.ForeColor=vbRed
Label2.Font=Bold
Label2.FontName="Comic Sans MS"
Label2.FontSize=24
Label2.Caption=Text1.Text
End Sub

Fig:-2






Question : 7 Build a form with two drop down lists (combo boxes type 0), one for country name and the other for the name of the President/Head of the countries. When this form is loaded fill the lists from the arrays. If the user pulls down one of the lists and clicks on a country the name of corresponding country President/Head is displayed in the text box of the other list.

Ans:-
Fig :- 1





Private Sub Form_Load()
Dim country(5) As string
Dim i As Integer
country(0)="__Select__"
country(1)="India"
country(2)="Australia"
country(3)="America"
country(4)="Rusia"
country(5)="Japan"
Comb1.Additem(CStr(country(i)))
Next
Combo1.ListIndex = 0

Dim prdt(5) As String
prdt(0)="__Select__"
prdt(1)="Ram"
prdt(2)="Shyam"
prdt(3)="Kumar"
prdt(4)="AtalBihari"
prdt(5)="hamid raza"

For i=0 To UBound(prdt)
Combo2.ListIndex=0
End sub.



Question : 8 Create an application with 2 small picture boxes and one large picture box. Each of the small picture box has a radia button. When a radio button is selected, the corresponding image for the picture box gets placed in the large picture box and a level is generated with the caption of the selected picture just below the large picture box.

Ans:-
Fig :- 1




Private Sub Form_Load()
Picture1.Picture=LoadPicture("C:Document and SettingHamidDesktopViual BasicAssignmentsVB31.jpg")
Picture2.Picture=LoadPicture("C:Document and SettingHamidDesktopViual BasicAssignmentsVB33.jpg")
Label1.Visible=False
End Sub

Private Sub Option1_Click()
If Option1.Value=True Then
Picture3.Picture=Picture1.Picture
Label1.Visible="Picture1"
Label1.Visible=True
End If
End Sub

Private Sub Option2_Click()
If Option2.Value = True Then
Picture3.Picture=Picture2.Picture
Label1.Caption="picture 2"
Label1.Visible=True
End If
End Sub



Question : 9 Generate a list (use an array of appropriate dimensions) including name, given name and course and address of 10 students consecutively numbered. Generate a program, which prints all information of the students on request of a number (1 to 10).

Ans:-
Private Sub Command1_Click()
Dim i,j As integer
Dim arr(10,3) As string
For i=0 to 9
For j=0 to 2
If j=0 Then
arr(j,j)=InputBox("enter the name")
End If
If j=2 Then
arr(i,j)=InputBox("Enter the city")
End if
Next
Next

Dim sno As Integer
sno=InputBox("enter whichs student details you want to see")
Print "The name is " &arr(sno,0)
Print "The course is" &arr(sno,1)
Print "The city is " & arr(sno,2)

End sub



Question : 10 Create a Form with a picture box. Find some interesting pictures. Use a timer control to cycle the picture every 2 seconds.The form should close when the picture is clicked.

Ans:-
Fig :-1




Private Sub Timer1_Timer()
If Timer1.Interver=2000 Then
Picture1.Picture=LoadPicture("C:Document and SettingHamidDesktopViual BasicAssignmentsVB31.jpg")
End if
Timer1.Interval=4000
If Timer1.Interval=4000 Then
Picture1.Picture=LoadPicture("C:Document and SettingHamidDesktopViual BasicAssignmentsVB32.jpg")
End If
Timer1.Interval=6000
If Timer1.Interval=6000 Then
Picture1.Picture=LoadPicture("C:Document and SettingHamidDesktopViual BasicAssignmentsVB33.jpg")
End If
Timer1.Interval=8000
If Timer1.Interval=8000 Then
Picture1.Picture=LoadPicture("C:Document and SettingHamidDesktopViual BasicAssignmentsVB32.jpg")
End If
End sub






The last comments on this page:
Comment posted by nlmvrrEmogy( geruwqazmlmailstome.today ), 09/18/2017 at 1:00am (UTC):
3 month payday loans <a href="http://paydayloans2017.com"> payday loans direct lenders only</a> <a href="http://paydayloans2017.com"> online payday loan</a> http://paydayloans2017.com - online payday loans direct payday loan lenders

Comment posted by nwiecnEmogy( zqoivejtgumailstome.today ), 09/01/2017 at 6:18am (UTC):
same day payday loans <a href="http://cashadvances2017.com"> online payday loan</a> <a href="http://cashadvances2017.com"> online payday loans</a> http://cashadvances2017.com - payday loans online payday loans online same day

Comment posted by novhweEmogy( gwhpbjmigvmailstome.today ), 08/07/2017 at 9:43pm (UTC):
topbk59w6h buying viagra online - <a href="http://viagraonlinetop2017.com"> buy viagra online</a> - <a href=http://viagraonlinetop2017.com>buy viagra online</a> - <a href="http://viagraonlinetop2017.com"> online viagra</a> - viagra prescription online

Comment posted by blxzgsix( fibzaqgpartemmel.info ), 07/21/2017 at 12:25pm (UTC):
gfu66np1y9g4vzu99u

<a href="https://bybklfn.info/">order baclofen</a>

<a href=https://bybklfn.info/>buy baclofen online</a>

01g6zd1afndctstqql

Comment posted by Kennentish( emailktry-rx.com ), 06/23/2017 at 1:19pm (UTC):
Discount Nonprescription Tadalis Sx <a href=http://viagra.ccrpdc.com/cheap-viagra-fast.php>Cheap Viagra Fast</a> Real Cod Only Stendra No Prescription Medication Priligy Uso <a href=http://vardenafil-levitra.buylevi.com>Vardenafil Levitra</a> Cephalexin Breast Feeding A Vendre Levitra En Suisse <a href=http://kamagra-pills.kamagpills.com>Kamagra Pills</a> Efectos Kamagra Oral Jelly Tadalafil Cialis 20 Mg <a href=http://cial40mg.com/buy-cheap-cialis-on-line.php>Buy Cheap Cialis On Line</a> Flank Pain While Taking Amoxil Viagra Generika Ohne Kreditkarte <a href=http://viacheap.com>buy viagra</a> Comprar Kamagra En Valencia

Comment posted by ggbif6( 75mnt7gmail.com ), 06/21/2017 at 6:16pm (UTC):
<a href=http://invelevoria.com>invelevoria</a>
kfzha47y45l2pr06ra

Comment posted by 1ttod8( yo6v30gmail.com ), 06/19/2017 at 7:48am (UTC):
7o8vo3ajafh7x8wfaa

Comment posted by Chrsacle( emailtry-rx.com ), 06/14/2017 at 11:21am (UTC):
Discount Cipro <a href=http://levitra-in-usa.buylevi.com>Levitra In Usa</a> Cialis Y La Diabetes Cialis Y De <a href=http://levitra-buy-us.buylevi.com>Levitra Buy Us</a> Achat De Pilule Levitra Dutasteride 0.5mg Delivered On Saturday <a href=http://cialis-to-buy.BuyCial.com>Cialis To Buy</a> Viagra Pfizer Uso Uses For Keflex <a href=http://kamagra-online-cheap.kamagorder.com>Kamagra Online Cheap</a> Suisse Acheter Kamagra Kamagra Prix En France <a href=http://cialis-cost.cial5mg.com>Cialis Cost</a> Finasteride Isotrex Symbicort <a href=http://cialbuy.com>viagra cialis</a> Amoxil Pediatrique Gouttes Acheter Generic Cialis One A Day <a href=http://cheap-viagra-pill.via100mg.com>Cheap Viagra Pill</a> Levitra Germany Priligy Cialis Crise Cardiaque <a href=http://leviplus.com/levitra-price-check.php>Levitra Price Check</a> Cephalexin 500mg Capsule Side Effects Sinus Infection Treatment Amoxicillin Dossage <a href=http://viaprices.com>viagra online</a> In Linea Di 25 Mg Di Sildenafil Dapoxetine For Sale <a href=http://where-to-buy-dapoxetine.priliorder.com>Where To Buy Dapoxetine</a> Cheap Viagra Online Prescription Buy Celexa <a href=http://bpdrugs.com/cialis-20mg-price.php>Cialis 20mg Price</a> Buy Oristat When Does Cephalexin Expire <a href=http://leviusa.com>levitra without rx in the united states</a> Cephalexin Hcl Opth Propecia Eficaz <a href=http://leviusa.com>mail order levitra 90 day supply</a> Medicament Generique Du Viagra Amoxicillin Skin Disorders Dosage <a href=http://brandcial.com/cheapest-cialis.php>Cheapest Cialis</a> Zebeta Fluoxetine Tablet Over Night Henderson <a href=http://purchase-cheap-cialis.BuyCial.com>Purchase Cheap Cialis</a> Effects Achat Kamagra Oral Jelly <a href=http://cheapest-kamagra.kamagorder.com>Cheapest Kamagra</a> Precio Viagra Hombre Propecia Sample Pack <a href=http://best-levitra.levitab.com>Best Levitra</a> Cialis Et Maux De Tete Viagra Forum Pfizer <a href=http://leviplus.com/levitra-price.php>Levitra Price</a> Cialis Viagra Online Baclofen Riva Senna <a href=http://viaprices.com>viagra</a> Cialis En Gibraltar Viagra Rouge <a href=http://dprixe.com>where to purchase low cost levitra</a> Blog Sur Clomid Cialis Scaduto <a href=http://costofvia.com/generic-viagra-cheap.php>Generic Viagra Cheap</a> Acheter Viagra Pfizeracheter En Perpignan Levitra Bei Erkaltung <a href=http://cialcost.com/shop-cialis-online.php>Shop Cialis Online</a> Clomid For Pct Zithromax Syrup <a href=http://price-generic-viagra.viasample.com>Price Generic Viagra</a> Viagra Sildenafil 100 Preis

Comment posted by Geordauffix( delivtry-rx.com ), 05/12/2017 at 11:36am (UTC):
How To Spell Amoxicillin Cheap Silagra Buy Synthroid No Prescription <a href=http://byuvaigranonile.com>viagra</a> Macrobid In Australia Co Viagra Kaufen Preisvergleich Nebenwirkungen Viagra Ohne Rezept

Comment posted by Louis Vuitton Small Leather Goods sale( bbzxbznzfpvgmail.com ), 12/07/2013 at 3:57pm (UTC):
hello there and thank you in your information ?I have definitely picked up anything new from right here. I did however experience some technical points using this website, since I skilled to reload the web site many occasions previous to I may get it to load properly. I had been puzzling over in case your web host is OK? No longer that I am complaining, but sluggish loading cases occasions will often have an effect on your placement in google and can harm your high quality score if advertising and ***********|advertising|advertising|advertising and *********** with Adwords. Well I am adding this RSS to my e-mail and can glance out for a lot more of your respective interesting content. Ensure that you replace this again soon..

Comment posted by guild wars 2 power leveling( bczwmpclukaoll.com ), 06/30/2013 at 7:26am (UTC):
I like those guild wars 2 power leveling!!!i bought all of them on brown lightly as a birthday gift that's pretty much a month ago whilst still being turn out good. the actual huge problem appeared to be the outside natural leather. it is almost all when it comes to differnt information and can make it gazed stamped. and so i in the morning repeatedly dealing with which will. that developed website marketing . applied for you to a lot of. single guild wars 2 power leveling ended up being applied more than the second plus they style of seem funi....the inner examiner end up getting chiseled quikley together with removes contentment.yet generally quite extremely cute!!!!



Add comment to this page:
Your Name:
Your Email address:
Your website URL:
Your message:

Login
 
Username:
Password:
Advertisement
 
Donate
 
You can help this website
by donate or
you can click an
advertisement.

IGNOU Students
 
Sample Synopsis

Time Table BCA 2009
Projects (Vb n ASPnet) : Download
Synopsis Form

Training Letter

Guide Remuneration Form

Certificates of Originality

Java KeyWords - PDF

Java KeyWords - Wikipedia


Click Here / Click Here

Edit Plus (Use it as Java editor) Download

How to configure EditPlus to compile JAVA codes click here


Advertisement
 
PC Games (Full, Rip, Compressed)
 
 
© 2007 - 2009 HamidRaza - Today, there have been 60 visitors (670 hits) on this page!
=> Do you also want a homepage for free? Then click here! <=