Welcome to Dream.In.Code
Become a VB Expert!

Join 137,262 VB Programmers for FREE! Get instant access to thousands of VB experts, tutorials, code snippets, and more! There are 1,510 people online right now. Registration is fast and FREE... Join Now!




Creating an application that will display square/square root

 
Reply to this topicStart new topic

Creating an application that will display square/square root

JessicaMorgan
12 Dec, 2006 - 10:01 AM
Post #1

New D.I.C Head
*

Joined: 12 Dec, 2006
Posts: 1


My Contributions
Hello, I attend an online college i desperately need some help in creating a progam that displays the square and square of a number. By the way, I'm new to this (1 months) and i'm studying computer informations and this visual basic 6.0 is giving me a hard time...lol...Any way, below is the assignment and what i have so far...Please don't laugh at me trying! biggrin.gif

a)create an application that displays the square and square root of a number.The application must have 2 forms.

b)One of the forms should resemble a standard dialog box which prompts for his or her name.

c)The name must be displayed on the main form when the main form is run

d)The main form should include a square/square root button, print button and exit button.

e)InputBox function should be used in the square/square root button to prompt user for number. The application should then display both the square and square root of the number

f)Print button shoud send the focus to the square/square root button



Here is what i have so far...

I have created a dialog box

Private Sub cmdOK_Click()
strName = txtName.Text
frmWelcome.Show
Unload frmName

End Sub


Private Sub Form_Load()
frmName.Left = (Screen.Width - frmName.Width) / 2
frmName.Top = (Screen.Height - frmName.Height) / 2

End Sub


Private Sub txtName_Change()

End Sub

...................

For my main form i have the coding which displays the name and a hello message

Private Sub Form_Load()
Const conMsg1 As String = "Hello "
lblWelcome.Caption = conMsg1 & strName & "," & vbNewLine

End Sub



I'm trying to figure out how to code the square/square button to prompt the user for the number and display the results on the main form. I already have the coding for the print and exit button.

.................
Please be patient i'm new at this. If anyone can help me i will aprreciate it.
Thx-Jessica
User is offlineProfile CardPM
+Quote Post

Mach1Guy
RE: Creating An Application That Will Display Square/square Root
12 Dec, 2006 - 12:09 PM
Post #2

D.I.C Head
Group Icon

Joined: 4 Dec, 2006
Posts: 79



Thanked: 4 times
Dream Kudos: 25
My Contributions
I believe you may be looking for something among these lines. Let me know if this is what your looking for.

CODE

Dim message, title, defaultValue As String

' Set prompt.
message = "Enter a value"
' Set title.
title = "InputBox Demo"
defaultValue = "1"   ' Set default value.

' Display message, title, and default value.
myValue = InputBox(message, title, defaultValue)

' If user has clicked Cancel, set myValue to defaultValue
If myValue Is "" Then myValue = defaultValue

User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/4/08 07:07PM

Live VB Help!

VB Tutorials

Reference Sheets

VB Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month