|
You need to show the code. The answer is, pass all the info you want to see, into the messagebox.
Christian Graus - C++ MVP
|
|
|
|
|
ok, here is the code:
Public Class CheckingAccount
Dim Service = "10.00"
Dim enterAmount As Decimal
Dim Balance As Decimal
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Private Sub menTransaction_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menTransaction.Click
With Me
enterAmount = Decimal.Parse(txtAmount.Text)
If butDeposit.Checked = True Then
Balance = Balance + enterAmount
totalNumOfDeposit = totalNumOfDeposit + 1
totalAmtOfDeposits = totalAmtOfDeposits + enterAmount
ElseIf butCheck.Checked = True Then
Balance = Balance - enterAmount
totalChecks = totalChecks + 1
totalAmountOfChecks = totalAmountOfChecks + enterAmount
ElseIf butService.Checked = True Then
Balance = Balance - Service
totalAmountOfService = totalamountOfChecks + Service
End If
Me.txtBalance.Text = Balance.ToString("C")
Me.txtAmount.Clear()
Me.txtAmount.Focus()
End With
End Sub
Private Sub menSummary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menSummary.Click
Dim Service As Decimal = "10.00"
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Dim messageString As String
With Me
If butDeposit.Checked = True Then
totalNumOfDeposit = totalNumOfDeposit + 1
totalAmtOfDeposits = totalAmtOfDeposits + enterAmount
ElseIf butCheck.Checked = True Then
totalChecks = totalChecks + 1
totalAmountOfChecks = totalAmountOfChecks + enterAmount
ElseIf butService.Checked = True Then
totalAmountOfService = totalAmountOfService + Service
End If
messageString = "Total Deposits: " _
& totalNumOfDeposit.ToString() _
& ControlChars.NewLine _
& "Total Amount Of Deposits: " & totalAmtOfDeposits.ToString() _
& ControlChars.NewLine _
& "Total Checks: " & totalChecks.ToString() _
& ControlChars.NewLine _
& "Total Amount of Checks: " & totalAmountOfChecks.ToString() _
& ControlChars.NewLine _
& "Total Amount of Service Charges: " _
& totalAmountOfService.ToString()
MessageBox.Show(messageString, "Checking Account Summary", _
MessageBoxButtons.OK, MessageBoxIcon.Information)
End With
End Sub
So, where do you think I've gone wrong?
Thanks for any help you can give me
Ruby
|
|
|
|
|
RubyM wrote: Dim Service As Decimal = "10.00"
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Dim messageString As String
People used to do this in C, because they had to. You should declare variables as you use them.
So you're saying this message box doesn't show all of the messageString ? Does it show the constants you're passing in ?
RubyM wrote: totalAmountOfChecks.ToString()
I don't believe you need to call ToString, it works it out.
Have you stepped through the debugger to see what's happening ?
RubyM wrote: enterAmount = Decimal.Parse(txtAmount.Text)
You should use TryParse, in case invalid chars are entered.
Christian Graus - C++ MVP
|
|
|
|
|
ok, I stepped through the debugger and don't seem to find any problems (then again, I'm am new to this and probably didn't know what to look for)
the message box shows all of the messageString, but somewhere along the line it is not doing the calculations like it should.
If I have the deposit button checked and enter 3 transactions of $50
then click on the "check" button and enter a transaction of $100
then choose the summary option in my menu the summary should look like this:
Total Deposits: 3
Amount of Deposits: $150
Total checks: 1
Amount of Checks: $100
Total Service charge: $0
but instead it will only show this:
Total Deposits: 0
Amount of Deposits: 0
Total checks: 1
Amount of checks: $100
Total Service charge: $0
I also tried it without the ToString() call and I get "0" for everything in my summary, so I do need the ToString() call.
So that's my problem. It's not holding all of the transactions like it should so I can display them in my summary.
Ruby
|
|
|
|
|
OK, I see now. You initially said 'I'm not seeing them'.
Private Sub menSummary_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles menSummary.Click
Dim Service As Decimal = "10.00"
Dim totalNumOfDeposit As Integer
Dim totalAmtOfDeposits As Decimal
Dim totalChecks As Decimal
Dim totalAmountOfChecks As Decimal
Dim totalAmountOfService As Decimal
Dim messageString As String
These are local variables. If you declare them outside of any method, then they will be member variables, which means they will keep their values between calls to this function.
Christian Graus - C++ MVP
|
|
|
|
|
Got it!! Thanks so much for your help!! It works great now.
Ruby
|
|
|
|
|
Hi, I am new to VB.Net. I am working on a program that needs to solve several one-variable nonlinear equations. For example, I have to solve f(x) = 0, where
f(x) = c0 + c1*x + c2*x^2 + c3*x^3 + c4*x^4 - A
c0, c1, ... c4 and A are constants. When given c0, c1, ..., c4 and A, the program should have the ability to solve f(x) = 0, and give back the value of x.
At first, I try to use try-and-error process to find the roots of the equation, but it failed. I searched online to find if any codes are related to this subject. Unfortunately, I found nothing. So I ask for help here.
If anyone can provide a useful algorithm for my question, it will be much appreciated. Thanks a lot for your help.;)
I am using VB.Net 2003.
+------------------------+
VB.Net, just beginning...
|
|
|
|
|
Some code that I believe would be similar to the example you gave would be:
<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
const double c0=0,c1=1,c2=2,c3=3,c4=4, A=1;<br />
double rval=0;
double toEval=Convert.ToDouble(this.numericUpDown1.Value);
<br />
rval=c0+c1*toEval+c2*(Math.Pow(toEval,2))+c3*(Math.Pow(toEval,3))+c4*(Math.Pow(toEval,4))-A;<br />
<br />
MessageBox.Show(rval.ToString());<br />
}<br />
The code may be slightly different to accomodate the different values of all the const variables. The numericUpDown1 is a control i put on the form just to quickly select the different numbers. Basically just follow your order of operations and look into the functions of the System.Math class.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
|
im creating a report using data report connection with data environment. please any body tll me how can i get the parent-child record by passing a query
|
|
|
|
|
in my project the form background color was not changed i have write the code to change the back color at run time but that code will not working what i have to do?
|
|
|
|
|
Post some code to see where you may have gone wrong.
|
|
|
|
|
Based on your varied questions in multiple forums in 1-2 days it appears you are looking for homework answers.
____________________________________________________
If at first you don't succeed, skydiving might not be for you.
|
|
|
|
|
|
Write a routine to Emit the IL that changes the back color property.
Do your homework yourself, or you'll get more replies like that one. How do you think you will learn anything if you ask others to answer your questions for you?
Arthur Dent - "That would explain it. All my life I've had this strange feeling that there's something big and sinister going on in the world."
Slartibartfast - "No. That's perfectly normal paranoia. Everybody in the universe gets that."
Deja View - the feeling that you've seen this post before.
|
|
|
|
|
how to register the vbsdk62.dll
using regsvr32.exe does not work
mermer4u
-- modified at 10:41 Saturday 25th November, 2006
|
|
|
|
|
Then it's not a COM dll.
Christian Graus - C++ MVP
|
|
|
|
|
in my project the form background color was not changed i have write the code to change the back color at run time but that code will not working what i have to do?
|
|
|
|
|
Is this a windows form or a web form?
Can you show us the Page_Load code you are using?
Jonathan Sampson
www.SampsonResume.com
|
|
|
|
|
If you look at his multiple posts in 1-2 days it appears he's looking for homework answers.
____________________________________________________
If at first you don't succeed, skydiving might not be for you.
|
|
|
|
|
Is their a method to find out the list of dll's that are registered on a machine, probably using vb script or using WMI.
I am trying to create a code to find out if the necessary versions of the dlls are registered on a client machine. Using the data from this generated list, I could then recommend the client to register the correct dll's.
PS: The software used is an old MS-Access application with some vb code and It doesnt have a setup kit. I need to manually find out the list of dll's on that machine and I would compare it with a set of dll's which are referenced by the program and get the version number existing on the client machine.
Tarakeshwar Reddy
MCP, CCIE Q(R&S)
Experience is like a comb that life gives you when you are bald - Navjot Singh Sidhu
|
|
|
|
|
Guys,
I have a NAT traversal issue that I need to solve using VB.Net and I can't do it with the .Net socket class.
Here is an overview....
Remote client sends out a UDP packet from its internal IP on port 1234. The NAT router maps it to the external IP plus a mapped port (let's say 9999)
My UDP listening software picks up the packet and I am able to find out the IP address and mapped port number (source port). The problem with NAT is that if I do not send a packet back from the same source port - it will be rejected (symmetric NAT).
So, in my VB/net app, I connect and send back a response as follows....
udpClient.Connect(RemoteIP, SourcePort)
'code to send the packet goes here
I use Ethereal to view the packet going out and the destination port is 9999 as expected, but the source port of the response gets mapped to a different port number. So, even though the packet hits the correct remote router port, it gets rejected because it came from a different source port.
My question is, what hardware device is mapping the source port of my packet and how do I stop this from happening - or work around it ?
|
|
|
|
|
i want code for combination in sql server and vb.net.for example in mytable,4 datas are 20,30,40,10.now these 4 datas in my table.then if i give input 70 means output to come like (1,2,4)i.e.1st data + 2nd data + 4th data,like that if i give input 50 means,output should come like (1,2) and (3,4).
|
|
|
|
|
This is one of the packing problems[^] that is common in homework assignments.
This one is usually defined as having a container with a specific size (70) and a number of boxes of different sizes, and the task is to find the combinations that fills the container.
A variation of this is where you have an amount of change to return to a customer, and the task is to make a combination with the least number of coins to add upp to that amount. The difference here is of course that you have an unlimited number of each coin.
To solve this you need to try each combination and see which ones that fit. Sort the items in descending size order and loop throught the combinations.
Of course I won't give you code for this. To write the actual code is your assignment.
---
b { font-weight: normal; }
|
|
|
|
|
what...what u r saying...for dout only i ask...but u written something...if u know means u can say...othrwise live it...ok...sorry...
|
|
|
|