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

Please support our VB.NET advertiser: Intel Parallel Studio Home
Reply

Join Date: Feb 2005
Posts: 17
Reputation: shelly121 is an unknown quantity at this point 
Solved Threads: 0
shelly121 shelly121 is offline Offline
Newbie Poster

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

 
0
  #1
Feb 21st, 2005
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:
*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
Reply With Quote Quick reply to this message  
Join Date: Mar 2005
Posts: 65
Reputation: cpopham is an unknown quantity at this point 
Solved Threads: 0
cpopham cpopham is offline Offline
Junior Poster in Training

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

 
0
  #2
Mar 14th, 2005
You may want to use Select Case or
If, ElseIf statements.

Chester
Reply With Quote Quick reply to this message  
Join Date: Jun 2008
Posts: 7
Reputation: gever is an unknown quantity at this point 
Solved Threads: 0
gever gever is offline Offline
Newbie Poster

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

 
0
  #3
Aug 1st, 2008
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
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 67
Reputation: lich has a little shameless behaviour in the past 
Solved Threads: 4
lich lich is offline Offline
Junior Poster in Training

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

 
0
  #4
Aug 1st, 2008
make it a Select case.. then you can do this issue..
Reply With Quote Quick reply to this message  
Join Date: May 2008
Posts: 67
Reputation: lich has a little shameless behaviour in the past 
Solved Threads: 4
lich lich is offline Offline
Junior Poster in Training

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

 
0
  #5
Aug 1st, 2008
dont go for IF Statements as you having more than three conditions.. go for Select case.. that will be good..
Reply With Quote Quick reply to this message  
Join Date: Apr 2006
Posts: 143
Reputation: cutepinkbunnies is an unknown quantity at this point 
Solved Threads: 8
cutepinkbunnies's Avatar
cutepinkbunnies cutepinkbunnies is offline Offline
Junior Poster

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

 
0
  #6
Aug 2nd, 2008
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.

  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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the VB.NET Forum


Views: 2797 | Replies: 5
Thread Tools Search this Thread



Tag cloud for VB.NET
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC