Method keeps resulting in error

Im trying to create a bank account. In the bank account the user creates an account and puts whatever amount they want to open account. after account is created they can go to withdraw or deposit and add or subtract additional monty from the account. Im trying to use a method for the deposits but I keep getting an error"error C2064: term does not evaluate to a function taking 1 arguments" and Im not sure exactly what the problem is. I know the deposit has to be added to the balance and the balance needs to be updated but I cant even get to that point. Im using Visual Studio 2010 Window forms application,here is the code I'm entering.
	if (tabControl1->SelectedTab == tabPage2)
			double depamount;
			double BalDep;
			double FindDepBal;
			BalDep = (bal - depamount);
			Double::TryParse(txtDeposit->Text, depamount);
			lblBal->Text = FindDepBal.ToString();

			txtDeposit->Text = BalDep.ToString();
What is this line?

Double::TryParse(txtDeposit->Text, depamount);

You're trying to call a member function without first declaring an object to call it on. In a sense, you can't do that...

I'm assuming Double is a class you made, and TryParse is one of the member functions or it's a function in a namespace named Double. Regardless, it doesn't look right.

I also have no clue what txtDeposit is supposed to be and you haven't given us the line the error actually resides on.
txtDeposit is the name of the text box the user enters the amount of money they want to deposit. the error is on


I used

Double::TryParse because the txtdeposit is a double for the amount being entered to deposit
Might want to try moving this thread to the windows forum or posting over there. I'm unfamiliar with any of the windows form builder stuff or windows functions in general. Double::TryParse still doesn't look right to me, but if the compiler says it is fine, I guess it is. MY best guess on FindDepBal is that it doesn't exist as a function, or it is a function but requires different parameters. Here is the MSDN link for your specific error:

MSDN wrote:
A call is made to a function through an expression. The expression does not evaluate to a function pointer.

Edit: I just read that it can also be caused by a variable being named the same as a function. Double check to make sure a variable within that scope doesn't have the name of the function you're trying to call.
Last edited on
Topic archived. No new replies allowed.