Click here to Skip to main content
16,005,181 members
Home / Discussions / Visual Basic
   

Visual Basic

 
Questionconnect to remote mechine Pin
thomas_joyee29-May-06 22:29
thomas_joyee29-May-06 22:29 
AnswerRe: connect to remote mechine Pin
Malik Nasir30-May-06 2:49
Malik Nasir30-May-06 2:49 
AnswerRe: connect to remote mechine Pin
Malik Nasir30-May-06 2:49
Malik Nasir30-May-06 2:49 
QuestionPrinting Pin
rankin_520429-May-06 21:49
rankin_520429-May-06 21:49 
AnswerRe: Printing Pin
Duncan Edwards Jones29-May-06 22:16
professionalDuncan Edwards Jones29-May-06 22:16 
AnswerRe: Printing Pin
Steve Pullan30-May-06 13:26
Steve Pullan30-May-06 13:26 
QuestionDrag and Drop? Pin
spelltwister29-May-06 20:28
spelltwister29-May-06 20:28 
QuestionUpDown Validation [modified] Pin
spelltwister29-May-06 20:20
spelltwister29-May-06 20:20 
Hey everyone,

I'm having a problem with an updown thingy. When you click the up and down arrows it adds or subtracts from your total money to spend, but if you manually imput a number into the box it doesn't change the money. :-/

Here's part of my code where "rs" is the total you have to spend:


Private Sub resourcesValue()<br />
        If purchase Then<br />
            spent = scal + sinf + sgen + sart + skni + sport<br />
            lblResources.Text = "Available Resources: " & rs - spent<br />
            If (rs - spent < 0) Then<br />
                lblResources.ForeColor = Color.Red<br />
                btnPurchase.Enabled = False<br />
            Else<br />
                lblResources.ForeColor = Color.Black<br />
                btnPurchase.Enabled = True<br />
            End If<br />
        End If<br />
    End Sub<br />
    Private Sub udCalvary_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles udCalvary.ValueChanged<br />
        scal = udCalvary.Value * 8<br />
        resourcesValue()<br />
    End Sub<br />
    Private Sub udKnight_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles udKnight.ValueChanged<br />
        skni = udKnight.Value * 11<br />
        resourcesValue()<br />
    End Sub<br />
    Private Sub udInfantry_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles udInfantry.ValueChanged<br />
        sinf = udInfantry.Value * 5<br />
        resourcesValue()<br />
    End Sub

I have limits set, but it does not return to the maximum when i push the button. Here's what happens.

I have 80 money to spend. I enter into the udInfantry control the number 80, meaning I need 400 money, but when I push the button, it gives me the 16 infantry that I purchased that turn (IE, 80/5 is 16 infantry) and does not subtract anything from my money.

I believe this is how you set limits:

<br />
udCalvary.Maximum = Math.Floor(rs / 8)<br />
        udKnight.Maximum = Math.Floor(rs / 11)<br />
        udInfantry.Maximum = Math.Floor(rs / 5)<br />
        udArtillery.Maximum = Math.Floor(rs / 10)<br />
        udGeneral.Maximum = 1<br />
        If Math.Floor(rs / 10) >= 1 Then<br />
            udPort.Maximum = 1<br />
        Else<br />
            udPort.Maximum = 0<br />
        End If

Any idea?

Mike

Gaming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!

-- modified at 2:21 Tuesday 30th May, 2006ming at the GuildofBlades.com is the only way to really experiece the level 99 Soul-Sucking Sword!
QuestionWizards in VB.NET Pin
bryndabella29-May-06 8:57
bryndabella29-May-06 8:57 
GeneralRe: Wizards in VB.NET Pin
User 171649229-May-06 13:29
professionalUser 171649229-May-06 13:29 
GeneralRe: Wizards in VB.NET Pin
bryndabella29-May-06 21:24
bryndabella29-May-06 21:24 
GeneralRe: Wizards in VB.NET Pin
Wesley Burger29-May-06 21:44
Wesley Burger29-May-06 21:44 
Questionhow to create external exe Pin
rutu10029-May-06 8:54
rutu10029-May-06 8:54 
AnswerRe: how to create external exe Pin
Steve Pullan29-May-06 13:24
Steve Pullan29-May-06 13:24 
Questionvb.net shortcut icon won't appear in deployment Pin
ryderson29-May-06 7:52
ryderson29-May-06 7:52 
AnswerRe: vb.net shortcut icon won't appear in deployment Pin
Malik Nasir30-May-06 2:56
Malik Nasir30-May-06 2:56 
GeneralRe: vb.net shortcut icon won't appear in deployment Pin
randyleepublicWTF17-Jan-09 2:30
randyleepublicWTF17-Jan-09 2:30 
QuestionRegarding Macro in VB.Net Pin
Arunchid29-May-06 6:34
Arunchid29-May-06 6:34 
AnswerRe: Regarding Macro in VB.Net Pin
Malik Nasir30-May-06 2:57
Malik Nasir30-May-06 2:57 
QuestionUse of rasdial in VB.NET?? Pin
b_girl29-May-06 5:41
b_girl29-May-06 5:41 
GeneralRe: Use of rasdial in VB.NET?? Pin
User 171649229-May-06 13:38
professionalUser 171649229-May-06 13:38 
GeneralRe: Use of rasdial in VB.NET?? Pin
b_girl31-May-06 3:43
b_girl31-May-06 3:43 
Question.exe running problem Pin
D11129-May-06 5:19
D11129-May-06 5:19 
AnswerRe: .exe running problem Pin
Malik Nasir30-May-06 3:01
Malik Nasir30-May-06 3:01 
QuestionSynchronizing calls to a function. Pin
coolestCoder29-May-06 5:14
coolestCoder29-May-06 5:14 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.