Tutorial Difficulty : Easy 1/5
:: ALL CLIENT SIDE :: Open frmDrop Add the required controls: 1 option button - optBtns - next to the buttons 1 option button - optTxtbox - next to the textbox 1 text box - txtAmount
[edit]
In the form's code, find Private Sub ProcessAmmount() and make it look like this:
Private Sub ProcessAmmount() Dim InvNum As Long
InvNum = frmMirage.lstInv.ListIndex + 1 ' Check if more then max and set back to max if so If Ammount > GetPlayerInvItemValue(MyIndex, InvNum) Then Ammount = GetPlayerInvItemValue(MyIndex, InvNum) End If ' Make sure its not 0 If Ammount <= 0 Then Ammount = 1 End If ' Check which option button is clicked If optTxtbox.Value = True Then Ammount = txtAmount.Text If optBtns.Value = True Then frmDrop.lblAmmount.Caption = Ammount & "/" & GetPlayerInvItemValue(MyIndex, InvNum) End If End Sub
That's all you need to do! It's that simple!
I hope you liked this tutorial!
[edit2] Fixes: Now, also you could go more advanced and make it add to the amount when the button was pressed and optTxtbox was clicked. I think I left something out here also.
Here's fix 1a of this tutorial: You have to add this to every button's code on the form. (the +10 -10, etc buttons) I'm only giving one button's code here though.
Private Sub cmdPlus1_Click() If optBtns.Value = True Then Ammount = Ammount + 1 Call ProcessAmmount End If End Sub
and here's fix 1b: I forgot to add to the textbox's code that when it you type into it, it has to reprocess the amount.
Private Sub txtAmount_Change() If optTxtbox.Value = True Then Call ProcessAmmount End If End Sub
That is all known bugs and their fixes with this code.
more fixes: I discovered more bugs with this tutorial when I was just looking over the code.
Change
If optTxtbox.Value = True Then Ammount = txtAmount.Text to:
If optTxtbox.Value = True Then Ammount = txtAmount.Text lblAmmount.Caption = Ammount End If
Note: Apply this fix ONLY if you want the amount to reflect in the label lblAmmount's caption.
Thanks!
|