It looks like you're using an Ad Blocker.
Please white-list or disable AboveTopSecret.com in your ad-blocking tool.
Thank you.
Some features of ATS will be disabled while you continue to use an ad-blocker.
New York City
441600
Los Angeles
350100
Chicago
167400
Houston
167800
Philadelphia
209800
Phoenix
159100
San Antonio
160600
San Diego
405400
Dallas
157200
San Jose
685000
Option Strict On
Imports System.IO
Public Class frmMedianHomePrices
Private _intRateOfIncrease As Integer = 0.03D
Public Shared _intSizeOfArray As Integer = 9
Public Shared _strHouse(_intSizeOfArray) As String
Private _strItemID(_intSizeOfArray) As String
Private _decInitialHousePrice(_intSizeOfArray) As Decimal
Private _intQuantity(_intSizeOfArray) As Integer
Private Sub frmMedianHomePrices_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Dim objReader As IO.StreamReader
Dim strLocationAndNameOfFile As String = "C:\USMedianHomePrices\cities.txt"
Dim intCount As Integer = 0
Dim intFill As Integer
Dim strFileError As String = "File not available"
Dim FileLines As New List(Of String)
'Doesn't work
'If IO.File.Exists(strLocationAndNameOfFile) Then
' objReader = IO.File.OpenText(strLocationAndNameOfFile)
' Do While objReader.Peek -1
' _strHouse(intCount) = objReader.ReadLine()
' _strItemID(intCount) = objReader.ReadLine()
' _decInitialHousePrice(intCount) = Convert.ToDecimal(objReader.ReadLine())
' _intQuantity(intCount) = Convert.ToInt32(objReader.ReadLine())
' intCount += 1
' Loop
' objReader.Close()
' For intFill = 0 To (_strItemID.Length - 1)
' lstSelectCity.Items.Add(_strItemID(intFill))
' Next
'Else : MsgBox(strFileError, , "Error")
'End If
'Works but shows the home prices when it's supposed to not be visible...only used begin the math.
' lstSelectCity.Items.AddRange(System.IO.File.ReadAllLines(strLocationAndNameOfFile))
'This works
If IO.File.Exists(strLocationAndNameOfFile) Then 'Chech if the file exists
FileLines.AddRange(IO.File.ReadAllLines(strLocationAndNameOfFile)) 'add each item to an element on the list
If FileLines.Count > 0 Then 'check if the file is larger than 0 items
For x = 0 To FileLines.Count - 1 Step 2 'show every other item
lstSelectCity.Items.Add(FileLines(x)) 'Add the item to the list held as x
Next
End If
Else
MsgBox("error", MsgBoxStyle.Critical, "error")
End If
End Sub
End Class
originally posted by: undo
a reply to: wwe9112
did you do a google search for ways to do that?
Private Sub btnCalculate_Click(sender As Object, e As EventArgs) Handles btnCalculate.Click
Dim intNewYorkCityInitialHouseCost As Integer = 441600
Dim intLAInitialHouseCost As Integer = 350100
Dim intChicagoInitialHouseCost As Integer = 167400
Dim intHoustonInitialHouseCost As Integer = 167800
Dim intPhiladelphiaInitialHouseCost As Integer = 209800
Dim intPhoenixInitialHouseCost As Integer = 159100
Dim intSanAntonioInitialHouseCost As Integer = 160600
Dim intSanDiegoInitialHouseCost As Integer = 405400
Dim intDallasInitialHouseCost As Integer = 157200
Dim IntSanJoseInitialHouseCost As Integer = 685000
Dim strSelectedCity As String = lstSelectCity.Text
Dim decLAFinalPrice As Decimal
If strSelectedCity = "New York City" Then
lblSelectedCityResultLabel.Text = "New York City Median House price is: " & intNewYorkCityInitialHouseCost.ToString("C")
Else
If strSelectedCity = "Los Angeles" Then
lblSelectedCityResultLabel.Text = "LA Median House price is: " & intLAInitialHouseCost.ToString("C")
'For intLAInitialHouseCost = 0 To 4
' intLAInitialHouseCost = (intLAInitialHouseCost * _intRateOfIncrease)
' intLAInitialHouseCost = CInt(intLAInitialHouseCost + decLAFinalPrice)
' lstExpectedIncreaseValueResult.Items.Add(intLAInitialHouseCost.ToString("C"))
'Next
Else
If strSelectedCity = "Chicago" Then
lblSelectedCityResultLabel.Text = "Chicago Median House price is: " & intChicagoInitialHouseCost.ToString("C")
Else
If strSelectedCity = "Houston" Then
lblSelectedCityResultLabel.Text = "Houseton Median House price is: " & intHoustonInitialHouseCost.ToString("C")
Else
If strSelectedCity = "Philadelphia" Then
lblSelectedCityResultLabel.Text = "Philadelphia Median House price is: " & intPhiladelphiaInitialHouseCost.ToString("C")
Else
If strSelectedCity = "Phoenix" Then
lblSelectedCityResultLabel.Text = "Phoenix Median House price is: " & intPhoenixInitialHouseCost.ToString("C")
Else
If strSelectedCity = "San Antonio" Then
lblSelectedCityResultLabel.Text = "San Antonio Median House price is: " & intSanAntonioInitialHouseCost.ToString("C")
Else
If strSelectedCity = "San Diego" Then
lblSelectedCityResultLabel.Text = "San Diego Median House price is: " & intSanDiegoInitialHouseCost.ToString("C")
Else
If strSelectedCity = "Dallas" Then
lblSelectedCityResultLabel.Text = "Dallas Median House price is: " & intDallasInitialHouseCost.ToString("C")
Else
If strSelectedCity = "San Jose" Then
lblSelectedCityResultLabel.Text = "San Jose Median House price is: " & IntSanJoseInitialHouseCost.ToString("C")
End If
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
End Class
originally posted by: Aedaeum
StackOverflow would be the best place for questions like this.
My personal suggestion is, use a real programming language