| | |
help with array please
Please support our VB.NET advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
![]() |
VB.NET Syntax (Toggle Plain Text)
Public Class Form1 Private Sub TextBox1_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.MouseHover ToolTip1.SetToolTip(TextBox1, "Cash Flow") End Sub Private Sub TextBox2_MouseHover(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox2.MouseHover ToolTip1.SetToolTip(TextBox2, "Account Balance") End Sub Private Sub TextBox1_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox1.MouseDown TextBox1.Clear() End Sub Private Sub TextBox2_MouseDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles TextBox2.MouseDown TextBox2.Clear() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click 'these variable need to plug into an equation dim name as string Dim current As Decimal Dim toBuy As Integer Dim startPrice As Decimal Dim newPrice As Decimal Dim totalNeed As Decimal Dim quantity As Integer Dim subNeed As Decimal Dim account As Decimal Dim flow As Decimal Dim hours As Decimal 'this is the equation newPrice = current + (toBuy) * (0.1 * startPrice) totalNeed = newPrice * quantity subNeed = totalNeed - account hours = subNeed / flow MsgBox("it will take you " & hours & " hours to save up for " & quantity & name & "'s. ") End Sub End Class
for example, the plaza that i was about to click on (in the pic)
it is in combobox1, it is plaza, and its starting price is 1000000 dollars.
it has a starting price, but depending on how many somebody already owns it has a current price. you can find out the current price by plugging what you know into the equation:
newPrice = (current) + (toBuy) * (0.1 * startPrice)
you then plug the rest of these into some more code(not shown yet) to get the hours to save up.
my question is, how do i make an array that has the name and starting price associated with the combobox1.
so when i click the plaza it plugs the startPrice into the equation and it plugs the name into the msgbox output string.
please help, ive been struggling with this for a couple weeks now.
best regards!!!
Here is some example code of how to set up an array:
I would actually recommend using an array of a Class instead of using a multidimensional array of type string.
vb Syntax (Toggle Plain Text)
'Declare Array Dim properties(3, 1) As String 'Set values of Array properties(0, 0) = "Plaza" properties(0, 1) = "1000000" properties(0, 0) = "Seaside Lot" properties(0, 1) = "1500000" properties(0, 0) = "Restaurant" properties(0, 1) = "3000000" 'Retreive values of Array Dim newPrice, current, toBuy As Double newPrice = current + toBuy * (0.1 * properties(0, 1))
I would actually recommend using an array of a Class instead of using a multidimensional array of type string.
![]() |
Similar Threads
- Can I ghost a RAID array??? (Windows NT / 2000 / XP)
- Creating dynamic array structures (C++)
- Array limit (C)
- struct dynamic 2d array alloc (C)
- string to integer array transformation (C)
- Array (Visual Basic 4 / 5 / 6)
Other Threads in the VB.NET Forum
- Previous Thread: Using Select Statement to retrieve data from SQL Server 2005 database
- Next Thread: error creating substring
| Thread Tools | Search this Thread |
.net .net2008 2005 2008 access account add application array basic beginner browser button buttons center check click code combo cpu crystalreport cuesent database datagrid datagridview date datetimepicker designer dissertation dissertations dissertationtopic dropdownlist excel exists fade file-dialog filter forms ftp generatetags html images input insert intel listview mobile module monitor mysql net number open output panel passingparameters picturebox picturebox2 port print printing printpreview problem regex reuse right-to-left searchvb.net select settings shutdown socket sqldatbase sqlserver storedprocedure survey tcp temperature textbox timespan transparency trim txttoxmlconverter user usercontol vb vb.net vb.netformclosing()eventpictureboxmessagebox vb2008 vbnet vista visual visualbasic.net visualstudio.net visualstudio2008 web winforms wpf wrapingcode xml year





