943,386 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 2971
  • VB.NET RSS
Feb 21st, 2005
0

HELP please!!vb.net help.....

Expand Post »
hello,i need to make an if statement for a mortgage application in vb.net, basically i have a list box for the DOB called cmbDOB, and a label to show the maximum mortgage. But i dont know how to make the if statement-it has to show the maximum mortage in the label depending on the following:
Quote ...
*Over 50yrs- maximum mortage = 15yrs
*between 40 - 50 = 20yrs
*Between 30 - 40 = 25
*betwen 18 - 30 = 30yrs
*Under 18yrs - NO mortgage!
but my list box has the DOB's as follows - 1940......to....1985. anyone good at writing vb.net language and wanna help me!!!!!please!!!!!!!! :o
Reputation Points: 10
Solved Threads: 0
Newbie Poster
shelly121 is offline Offline
17 posts
since Feb 2005
Mar 14th, 2005
0

Re: HELP please!!vb.net help.....

You may want to use Select Case or
If, ElseIf statements.

Chester
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
cpopham is offline Offline
65 posts
since Mar 2005
Aug 1st, 2008
0

Re: HELP please!!vb.net help.....

you can use if statements.

If [your condition here]
Your code here
ElseIf [your condition here]
Your code here
ElseIf [your condition here]
Your code here
Else
Your code Here
End If

for more follow this link

http://vb.net-informations.com/progr...else_endif.htm
Reputation Points: 10
Solved Threads: 0
Newbie Poster
gever is offline Offline
9 posts
since Jun 2008
Aug 1st, 2008
0

Re: HELP please!!vb.net help.....

make it a Select case.. then you can do this issue..
Reputation Points: -1
Solved Threads: 4
Junior Poster in Training
lich is offline Offline
78 posts
since May 2008
Aug 1st, 2008
0

Re: HELP please!!vb.net help.....

dont go for IF Statements as you having more than three conditions.. go for Select case.. that will be good..
Reputation Points: -1
Solved Threads: 4
Junior Poster in Training
lich is offline Offline
78 posts
since May 2008
Aug 2nd, 2008
0

Re: HELP please!!vb.net help.....

To do this properly, I would focus on allowing the user to select their birthdate with a datetimepicker....or, convert their choices from your listboxes to a date.

You will need to insert error handling and other specifics on your own, as well as adjust the accuracy of the age...but this is very close to what you need.

VB.NET Syntax (Toggle Plain Text)
  1.  
  2. Public Class Form1
  3. Dim intage As Integer
  4.  
  5. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
  6. Dim dtdob As New Date(Me.ListBox1.SelectedItem.ToString, 1, 1)
  7. ' using this method of calculating the age of the client is inaccurate, but the
  8. ' function I used offers more granularity for calculating an exact age...you can tweak it.
  9. intage = Microsoft.VisualBasic.DateAndTime.DateDiff(DateInterval.Year, dtdob, Now)
  10. populatelistboxitems(intage)
  11. End Sub
  12.  
  13. Private Sub populatelistboxitems(ByVal intage As Integer)
  14. Me.ListBox2.Items.Clear()
  15. Select Case intage
  16. Case Is >= 50
  17. Me.ListBox2.Items.Add("10 year mortgage")
  18. Case Is >= 40
  19. Me.ListBox2.Items.Add("10 year mortgage")
  20. Me.ListBox2.Items.Add("20 year mortgage")
  21. Case Is >= 30
  22. Me.ListBox2.Items.Add("10 year mortgage")
  23. Me.ListBox2.Items.Add("20 year mortgage")
  24. Me.ListBox2.Items.Add("25 year mortgage")
  25. Case Is >= 18
  26. Me.ListBox2.Items.Add("10 year mortgage")
  27. Me.ListBox2.Items.Add("20 year mortgage")
  28. Me.ListBox2.Items.Add("25 year mortgage")
  29. Me.ListBox2.Items.Add("30 year mortgage")
  30. End Select
  31. End Sub
  32. End Class
Last edited by cutepinkbunnies; Aug 2nd, 2008 at 3:09 am.
Reputation Points: 15
Solved Threads: 9
Junior Poster
cutepinkbunnies is offline Offline
143 posts
since Apr 2006

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Want to run vb prg in vb.net
Next Thread in VB.NET Forum Timeline: Generating Random Passwords with ASP.NET and VB





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC