VB Help: Height, Weight for Men & Women

  • Thread starter Thread starter alanveron
  • Start date Start date
Click For Summary
SUMMARY

The discussion focuses on a Visual Basic (VB) script that calculates and displays height and weight for men and women based on user input. The script uses a loop to print values for height (x), weight for women (y), and weight for men (z) in a formatted manner. The user encountered an issue with the output formatting, specifically that the labels 'Height', 'Weight-women', and 'Weight-men' appeared concatenated. The solution provided involves modifying the Print statement to include spaces between the variables.

PREREQUISITES
  • Basic understanding of Visual Basic programming
  • Familiarity with variable declaration and data types in VB
  • Knowledge of loops and conditional statements in programming
  • Experience with output formatting in VB
NEXT STEPS
  • Explore Visual Basic string manipulation techniques
  • Learn about formatting output in Visual Basic using Print and other methods
  • Investigate user input handling in VB applications
  • Study debugging techniques for Visual Basic scripts
USEFUL FOR

Beginner to intermediate Visual Basic programmers, educators teaching programming concepts, and anyone interested in developing applications that require user input and formatted output.

alanveron
Messages
45
Reaction score
0
Picture1.Print "Height"; "Weight-women"; "Weight-men"
a = Val(Text1.Text)
b = Val(Text2.Text)

Dim x, y, z As Integer
x = a
y = x * 3.5 - 108
z = x * 4 - 128
Do
Picture1.Print x; y; z
x = x + 1
y = x * 3.5 - 108
z = x * 4 - 128
Loop Until x > b

this is my command...but my when i run it,the words 'heightweight-womenweight-men' all stay together...can i separate them?
if possible i would like the value of x will display in the same column with height,while y in the same column with weight-women and z will be in the same line with weight-men
 
Computer science news on Phys.org
just add spaces in your print statement:

Picture1.Print x & " "; y & " "; z
 

Similar threads

  • · Replies 5 ·
Replies
5
Views
3K
Replies
1
Views
2K
  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 9 ·
Replies
9
Views
2K
  • · Replies 0 ·
Replies
0
Views
3K
  • · Replies 20 ·
Replies
20
Views
6K
  • · Replies 93 ·
4
Replies
93
Views
17K
Replies
5
Views
2K
  • · Replies 175 ·
6
Replies
175
Views
29K
  • · Replies 33 ·
2
Replies
33
Views
9K