locked
"Expression is not a method" error RRS feed

  • Question

  • Hello,

    I'm trying to calculate a variable I called CLo in the following code and it gives me these two errors: Error 1: Expression is not a method & Error 2 Method arguments must be enclosed in parentheses.

    Your help is very much appreciated.

    Private Sub solve_Click(sender As Object, e As EventArgs) Handles solve.Click
        Dim W, rhu, U, B, beta, CLo As Double
    
        W = Val(weight.Text)
        rhu = Val(density.Text)
        U = Val(speed.Text)
        B = Val(beam.Text)
        beta = Val(deadrise.Text)
    
        CLo -(0.0065 * beta * (CLo ^ 0.6)) = W / (0.5 * rhu * U * U * B * B)
    
        TextBox1.Text = CLo
    
        Dim lambdaw As Double
        Dim Dimtau As Double
        Dim DimFnB As Double
    
        tau = Val(Trim.Text)
        FnB = U / ((32.2 * B) ^ 0.5)
        froude.Text = FnB
        lambdaw = (CLo / ((tau ^ 1.1) * (0.012 + (0.0055 * lambdaw * lambdaw) / (FnB * FnB))))
        TextBox2.Text = lambdaw
    End Sub
    

    • Edited by Reed KimbleMVP Friday, July 13, 2018 12:36 PM placed code in code block
    Friday, July 13, 2018 10:32 AM

All replies

  • Turn Option Strict On as the first line in the form.

    For those who want to help.

    Dim W, rhu, U, B, beta, CLo As Double
    
    W = Val(weight.Text)
    rhu = Val(density.Text)
    U = Val(speed.Text)
    B = Val(beam.Text)
    beta = Val(deadrise.Text)
    
    CLo -(0.0065 * beta * (CLo ^ 0.6)) = W / (0.5 * rhu * U * U * B * B)
    
    TextBox1.Text = CLo
    
    Dim lambdaw As Double
    Dim tau As Double
    Dim FnB As Double
    
    tau = Val(Trim.Text)
    FnB = U / ((32.2 * B) ^ 0.5)
    froude.Text = FnB
    lambdaw = (CLo / ((tau ^ 1.1) * (0.012 + (0.0055 * lambdaw * lambdaw) / (FnB * FnB))))
    TextBox2.Text = lambdaw


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    Friday, July 13, 2018 11:30 AM
  • Just curious, what are you wanting to calculate? Critical Depth?

    You will need to isolate the variable to one side of the equation.

    ie

    CLo = some function if the remaining variables

    Friday, July 13, 2018 11:36 AM
  • Thank you for your reply.

    I'm creating a tool to get some performance data of a craft.

    I was trying to isolate CLo but I couldn't. it comes in two different powers in the equation (CLo and CLo^0.6)

    if I couldn't find a solution for this I will try to find another expression for CLo.

    Friday, July 13, 2018 12:33 PM
  • Thank you for your reply.

    I'm creating a tool to get some performance data of a craft.

    I was trying to isolate CLo but I couldn't. it comes in two different powers in the equation (CLo and CLo^0.6)

    if I couldn't find a solution for this I will try to find another expression for CLo.

    Masr,

    If this is for school you should tell us.

    We dont know how or what you are supposed to solve or how and things etc and we try not to just give you the solution.

    Not that I know the solution.

    Those equations are used for lots of flow things.

    When you have two equations and two unknowns what do we do? Substitute.

    Also quadratic sometimes. But yes your ^0.6 is tricky. BTW should that be 2/3 ?

    Power series maybe?

    But that really has nothing to do with the programming part.

    However some equations are easier to program than others. Most have been done already.

    :)

    Friday, July 13, 2018 12:46 PM