- Option Explicit On
-
Option Strict On
-
-
Imports System.Globalization
-
-
Public Class MainForm
-
-
Private Sub exitButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles exitButton.Click
-
Me.Close()
-
End Sub
-
-
Private Sub MainForm_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
-
' fills the combo box with values, then selects the first value
-
-
For years As Integer = 3 To 20
-
lifeComboBox.Items.Add(years.ToString)
-
Next years
-
lifeComboBox.SelectedIndex = 0
-
End Sub
-
-
Private Sub displayButton_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles displayButton.Click
-
' displays a double-declining balance depreciation schedule
-
-
Dim cost As Double
-
Dim life As Double
-
Dim period As Double
-
Dim salvage As Double
-
Dim depreciation As Double
-
Dim isConvertedCost As Boolean
-
Dim isConvertedLife As Boolean
-
Dim isConvertedSalvage As Boolean
-
-
isConvertedCost = Double.TryParse(costTextBox.Text, _
-
NumberStyles.Currency, NumberFormatInfo.CurrentInfo, cost)
-
isConvertedLife = Double.TryParse(lifeComboBox.Text, life)
-
isConvertedSalvage = Double.TryParse(salvageTextBox.Text, _
-
NumberStyles.Currency, NumberFormatInfo.CurrentInfo, salvage)
-
-
If isConvertedCost AndAlso isConvertedLife AndAlso isConvertedSalvage Then
-
scheduleTextBox.Text = " Year Depreciation"
-
-
' write a For .... Next loop here to calculate the double declining balance
-
' depreciation and use a string concatenation to add the year and depreciation
-
' to the output text box.
-
-
-
-
-
Else
-
MessageBox.Show("The cost, life, and salvage values must be numeric.", _
-
"Sonheim Manufacturing Company", MessageBoxButtons.OK, _
-
MessageBoxIcon.Information)
-
End If costTextBox.Focus()
-
End Sub
-
-
-
Private Sub costTextBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles costTextBox.Enter
-
costTextBox.SelectAll()
-
End Sub
-
-
Private Sub costTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles costTextBox.TextChanged
-
scheduleTextBox.Clear()
-
End Sub
-
-
Private Sub lifeComboBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles lifeComboBox.TextChanged
-
scheduleTextBox.Clear()
-
End Sub
-
-
Private Sub salvageTextBox_Enter(ByVal sender As Object, ByVal e As System.EventArgs) Handles salvageTextBox.Enter
-
salvageTextBox.SelectAll()
-
End Sub
-
-
Private Sub salvageTextBox_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles salvageTextBox.TextChanged
-
scheduleTextBox.Clear()
-
End Sub
-
End Class
Ha ha .....to calculate the double declining balance
' depreciation and use a string concatenation to add the year and depreciation
' to the output text box.
Now I can write a for next statement but with string concatenation how would one do this
6 5191
Can you be more specific about exactly what you want help with? Are you simply asking how to concatenate two strings, or what?
Try to keep it brief - most people don't want to read through pages of code to try and find what it is that you want.
just point and explain the error area
rather than giving a complete code
write a For .... Next loop here to calculate the double declining balance
' depreciation and use a string concatenation to add the year and depreciation
' to the output text box.
This is what I am trying to do but I am not understanding how to do this with string concatenation
write a For .... Next loop here to calculate the double declining balance
' depreciation and use a string concatenation to add the year and depreciation
' to the output text box.
This is what I am trying to do but I am not understanding how to do this with string concatenation
For a start, you cannot use string concatenation to calculate the value. Concatenation is just the action of sticking things together in a string. The idea here is that once you have calculated your depreciation value, you will stick it together with the year. For example: strSomething = "Year:" & intYear & " Depreciation: $" & curDepreciation
From the sound of the question, I'd recommend you try hard to work your way through this, rather than expecting TheScripts to provide you with a complete program. To quote our policy as described in the FAQ...
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.
Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.
Then when you are ready post a new question in this thread.
MODERATOR
I am not expecting for anyone to supply me with anything. I just wanted some to point me in the right direction. I am new at this but clearly some people on here have forgotten how that feels. That is fine. I have figured it out, thanks.
I am not expecting for anyone to supply me with anything. I just wanted some to point me in the right direction. I am new at this but clearly some people on here have forgotten how that feels. That is fine. I have figured it out, thanks.
No, it's not that we've forgotten. We've just had a lot of trouble with people posting school assignments. We've even had professors in here taking us to task for giving out answers.
And really, if students copy and paste their questions, then copy and paste answers from here, it's not helping anyone. So we have to try to keep this sort of thing under control.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Jonas Galvez |
last post by:
Is it true that joining the string elements of a list is faster than
concatenating them via the '+' operator?
"".join()
vs
'a'+'b'+'c'
If so, can anyone explain why?
|
by: hagai26 |
last post by:
I am looking for the best and efficient way to replace the first word
in a str, like this:
"aa to become" -> "/aa/ to become"
I know I can use spilt and than join them
but I can also use regular...
|
by: John Ford |
last post by:
For simple string concatenation, is there a difference between...
Dim s As String
s += "add this to string"
....and...
Dim s As String
s = String.Concat(s, "add this to string")
|
by: Justin M. Keyes |
last post by:
Hi,
Please read carefully before assuming that this is the same old
question about string concatenation in C#!
It is well-known that the following concatenation produces multiple
immutable...
|
by: Mark A. Sam |
last post by:
Hello,
I am having a problem with imputting into a string variable:
Dim strSQL As String = "INSERT INTO tblContactForm1 (txtName, txtCompany,
txtPhone, txtEmail, txtComment, chkGrower,...
|
by: genc_ymeri |
last post by:
Hi over there,
Propably this subject is discussed over and over several times. I did google
it too but I was a little bit surprised what I read on internet when it
comes 'when to use what'.
Most...
|
by: Richard Lewis Haggard |
last post by:
I thought that the whole point of StringBuilder was that it was supposed to
be a faster way of building strings than string. However, I just put
together a simple little application to do a...
|
by: Larry Hastings |
last post by:
This is such a long posting that I've broken it out into sections.
Note that while developing this patch I discovered a Subtle Bug
in CPython, which I have discussed in its own section below.
...
|
by: =?Utf-8?B?RWxlbmE=?= |
last post by:
I am surprised to discover that c# automatically converts an integer to a
string when concatenating with the "+" operator. I thought c# was supposed
to be very strict about types. Doesn't it seem...
|
by: raylopez99 |
last post by:
StringBuilder better and faster than string for adding many strings.
Look at the below. It's amazing how much faster StringBuilder is than
string.
The last loop below is telling: for adding...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |