corsasport.co.uk
 

Corsa Sport » Message Board » Off Day » Geek Day » programming help


New Topic

New Poll
  Subscribe | Add to Favourites

You are not logged in and may not post or reply to messages. Please log in or create a new account or mail us about fixing an existing one - register@corsasport.co.uk

There are also many more features available when you are logged in such as private messages, buddy list, location services, post search and more.


Author programming help
flame1987
Member

Registered: 20th Nov 06
Location: North Wales
User status: Offline
   9th May 07 at 23:24   View User's Profile U2U Member Reply With Quote

i need some help probably very easy but head it battered at the minute and cant think straight

Basically i need to perform a calculation for a deposit based on a combo box answer and the total value

e.g

if combobox = yes then

deposit must be 10% of total amount

using visual studio too, thanks
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
10th May 07 at 00:04   View Garage View User's Profile U2U Member Reply With Quote

What language?

You have the idea -

if combo.value = 'yes' then
deposit = amount x 0.1
else
deposit = 0

That won't run of course - you need to sort the syntax.

[Edited on 10-05-2007 by Ian]
flame1987
Member

Registered: 20th Nov 06
Location: North Wales
User status: Offline
10th May 07 at 17:03   View User's Profile U2U Member Reply With Quote

Sorry .net
flame1987
Member

Registered: 20th Nov 06
Location: North Wales
User status: Offline
10th May 07 at 18:37   View User's Profile U2U Member Reply With Quote

I currently have this

If DepositAmountTextBox.Text <= AmountToBorrowTextBox.Text * 5 / 100 Then
ErrorProvider1.SetError(DepositAmountTextBox, "You must enter at least 5%")
Else
ErrorProvider1.SetError(DepositAmountTextBox, "")

But need it to only work when yes has been selected from a combo box
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
10th May 07 at 22:36   View Garage View User's Profile U2U Member Reply With Quote

If combobox value and all that stuff?
JamesMG
Member

Registered: 14th Nov 06
Location: Newcastle-under-Lyme, Staffordshire
User status: Offline
11th May 07 at 16:45   View User's Profile U2U Member Reply With Quote

you can enclose if statements within if statements..

so the first would check the status of the combo, either yes or no.. if no then msgbox.. do nothing etc..

if the value is yes then u can enclose another if statement which checks the values..

*edit*

Like so...

if combo1.value = "yes" then
if text2.text = "yes" then
shape1.backcolor = vbGreen
else
shape1.backcolor = vbRed
end if
end if


like that... there are a few limitations however but its probably the easiest way to do it..



[Edited on 11-05-2007 by JamesMG]
Paul_J
Member

Registered: 6th Jun 02
Location: London
User status: Offline
11th May 07 at 19:23   View User's Profile U2U Member Reply With Quote

quote:
Originally posted by flame1987
I currently have this

If DepositAmountTextBox.Text <= AmountToBorrowTextBox.Text * 5 / 100 Then
ErrorProvider1.SetError(DepositAmountTextBox, "You must enter at least 5%")
Else
ErrorProvider1.SetError(DepositAmountTextBox, "")


But need it to only work when yes has been selected from a combo box


That's nothing like the example you gave above

Use 2 radio buttons then... 1 saying yes, 1 saying no.

If Radiobutton1.Checked = True then

If ((DepositAmountTextBox.Text) <= (AmountToBorrowTextBox.Text * (5 / 100))) Then
ErrorProvider1.SetError(DepositAmountTextBox, "You must enter at least 5%")
Else
ErrorProvider1.SetError(DepositAmountTextBox, "")
End If

End If

I don't have my copy of visual stuido on this pc, so can't remember exact syntax... Do you need begin and end's in this ? lol

VB.net I assume? I'd use Message boxes instead of error providers.


[Edited on 11-05-2007 by Paul_J]
Ian
Site Administrator

Avatar

Registered: 28th Aug 99
Location: Liverpool
User status: Offline
11th May 07 at 19:25   View Garage View User's Profile U2U Member Reply With Quote

Not familiar with the syntax but it would make more sense to combine the conditions in one if statement?

if combo and amount then ...
flame1987
Member

Registered: 20th Nov 06
Location: North Wales
User status: Offline
12th May 07 at 19:56   View User's Profile U2U Member Reply With Quote

dont really want to use message boxes as there re 15 other formsof validation going on. So used errorprovider to prevent loads of messageboxes.


If CDec(DepositAmountTextBox.Text <= AmountToBorrowTextBox.Text * 5 / 100) And FirstTimeBuyerComboBox.Text = "Yes" Then
ErrorProvider1.SetError(DepositAmountTextBox, "You must enter at least 5%")
Exit Sub
Else
ErrorProvider1.SetError(DepositAmountTextBox, "")

End If

This statement seems to work

 
New Topic

New Poll

  Related Threads Author Forum Replies Views Last Post
"Progress" programming environment???? Mikorsa16v Geek Day 12 1295
23rd Jan 04 at 13:01
by Mikorsa16v
 
programming!!! topshot_2k Geek Day 0 895
21st Mar 05 at 13:36
by topshot_2k
 
Any programmers out there? Cosmo Geek Day 16 1879
28th Oct 05 at 16:46
by James
 
Immobiliser problem unknownmanxman Help Zone, Modification and ICE Advice 4 559
8th May 07 at 15:46
by unknownmanxman
 

Corsa Sport » Message Board » Off Day » Geek Day » programming help 29 database queries in 0.0186150 seconds