×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

need help with VB coding ASAP plzzzzzzzzzz

need help with VB coding ASAP plzzzzzzzzzz

need help with VB coding ASAP plzzzzzzzzzz

(OP)
Could anyone plz REWORD the following code (not comments) but still functions in exactly the same way as expressed below. The vb program is supposed to connect with AVS/Express. The program should allow the user to create a profile in 2D and then to generate the solid (bottle shape).  Many Thanks!   

'Declares variables
Dim iAngle As Integer
Dim fX2, fY2, fX1, fY1, fZ1, fZ2 As Double
Dim iLoop As Integer
Dim fRadians As Double
Dim fRadius As Integer
Dim iSteps As Integer
Dim iCount As Integer
Dim fXMin, fYMin, fXMax, fYMax, fX3, fY3 As Integer
Dim Sourcedat, Sourcefld As String


Private Sub Add_Click()
    'fX1 and fY1 variable equals the value in the X and Y coord textbox
    fX1 = Val(X.Text)
    fY1 = Val(Y.Text)
    fZ1 = 0
    iSteps = Val(Steps.Text)
    fY2 = fY1

    'Steps text box cannot be changed and uses disabled text colour
    Steps.Locked = True
    Steps.BackColor = &H80000011
    
    'The create command box is available for user
    Create.Enabled = True
    
    'Whole circle divided by lines
    iAngle = 360 / iSteps
    
    ' Converts anges into degrees
    fRadians = (iAngle * 3.1415926) / 180
    
    'Loops until reaches number of lines user has inputted
    For iLoop = 0 To iSteps - 1
    
    'Equations for X and Y axis for circle to be created
        fX2 = (Cos(iLoop * fRadians) * fX1)
        fZ2 = (Sin(iLoop * fRadians) * fX1)
        
    'Creates cross for points
            Picture1.Line (fX1 - 3, fY1 - 3)-(fX1 + 3, fY1 + 3), QBColor(5)
            Picture1.Line (fX1 - 3, fY1 + 3)-(fX1 + 3, fY1 - 3), QBColor(5)
    
    'Prints values of the variables into file 1
                Print #1, fX2, fY2, fZ2
    
    'Loop Again
    Next iLoop

    'Prints old values of variables into file 1
    Print #1, fX1, fY1, fZ1
    
    'Counts how points are entered
    iCount = iCount + 1
    
    'Create a line to each point
    If iCount > 1 Then
        Picture1.Line (fX1, fY1)-(fX3, fY3), QBColor(6)
    End If
    
    'Validating so that values do not go out of bounds of Axis
    If Val(X.Text) > 200 Then
        MsgBox ("Enter a value between 1 to 200 only!, Restarting!")
        Call Clear_Click
        
        ElseIf Val(Y.Text) > 200 Then
        MsgBox ("Enter a value beteen 1 to 200 only!, Restarting!")
        Call Clear_Click
        
        'Msg box will appear if user has entered more then 360
        ElseIf Steps > 360 Then
        MsgBox ("Enter value range of 2 to 360 only!, Restarting!")
        Call Clear_Click
    End If
    
    'Is used for making line to points
    fX3 = fX1
    fY3 = fY1
End Sub

Private Sub Clear_Click()
'Closes all disk files
    Reset
    
'Refreshes the picture 1
    Picture1.Refresh
    
'Calls Form_Activate Sub
    Call Form_Activate
    
End Sub

Private Sub Exit_Click()
'Closes the program
    End
    
End Sub

Private Sub Form_Activate()
'Variables is used to allow user to choose the location of files
    
    Sourcefld = InputBox("Enter FLD File Name, Dont forget the .fld", "Enter FLD File Name")
    Sourcedat = InputBox("Enter Data File Name, Dont forget the .dat, Enter Dat File Name")

'Opens file source
    Open Sourcedat For Output As #1

'Opens file so data can be entered into file
    Open Sourcefld For Output As #2

        'Declares values of text boxes
    X.Text = 0
    Y.Text = 0
    Steps.Text = 6
    Create.Enabled = False
    Steps.Locked = False
    Steps.BackColor = &H80000005
    fX3 = 0
    fY3 = 0
    
'Code used from Peter Wilson GraphEx1 Code but altered
        'Set window bounds
    fXMin = -20
    fXMax = 220
    fYMin = -20
    fYMax = 220
    Picture1.ScaleWidth = fXMax - fXMin
    Picture1.ScaleHeight = fYMin - fYMax
    Picture1.ScaleLeft = fXMin
    Picture1.ScaleTop = fYMax
    
        'Set Axes dimensions
    fAXMin = 0
    fAXMax = 200
    fXStep = 50
    fAYMin = 0
    fAYMax = 200
    fYStep = 50

        ' Draw the Axes.
    Picture1.Line (fAXMin, 0)-(fAXMax, 0)    'X-Axis
    Picture1.Line (0, fAYMin)-(0, fAYMax)    'Y Axis

        ' Annotate +ve X-Axis
    For iX = fXStep To fXMax Step fXStep
        Picture1.Line (iX, 5)-(iX, -5)
        Picture1.Print iX
    Next iX
        
        ' Annotate +ve Y-Axis
    For iY = fYStep To fYMax Step fYStep
        Picture1.Line (5, iY)-(-5, iY)
        Picture1.Print iY
    Next iY
   
End Sub

Private Sub Create_Click()
  'All information to be entered
    Print #2, "# AVS field file"
    Print #2, "ndim = 2"
    Print #2, "dim 1 ="; Val(Steps.Text) + 1
    Print #2, "dim 2 ="; iCount
    Print #2, "nspace = 3"
    Print #2, "data = double"
    Print #2, "field = irregular"
    Print #2, "coord 1 file ="; Sourcedat; " "; "filetype = ascii; Skip = 0; offset = 0; stride = 3; "
    Print #2, "coord 2 file ="; Sourcedat; " "; "filetype = ascii; Skip = 0; offset = 1; stride = 3; "
    Print #2, "coord 3 file ="; Sourcedat; " "; "filetype = ascii; Skip = 0; offset = 2; stride = 3; "
    Print #2, "variable 1 file ="; Sourcedat; " "; "filetype = ascii; Skip = 0; offset = 1; stride = 3; "

End Sub

RE: need help with VB coding ASAP plzzzzzzzzzz

==> Could anyone plz REWORD the following code (not comments) but still functions in exactly the same way as expressed below.

Why?

Good Luck
--------------
As a circle of light increases so does the circumference of darkness around it. - Albert Einstein

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources