• Want to help us with this year's BoS Trials?
    Let us know before 30 June. See this thread for details
  • Looking for HSC notes and resources?
    Check out our Notes & Resources page

VB Help Topic (1 Viewer)

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
You could also set the visible state of the label every interval from false to true, true to false etc...
 

Owyn

Member
Joined
Feb 1, 2004
Messages
102
Location
Sydney, NSW
Gender
Male
HSC
2006
k, thanks for the help. Thats going to make things really difficult, but if you guys don't know there isn't much chance i'll find out somewhere else.
 

Winston

Active Member
Joined
Aug 30, 2002
Messages
6,128
Gender
Undisclosed
HSC
2003
Originally posted by Owyn
k, thanks for the help. Thats going to make things really difficult, but if you guys don't know there isn't much chance i'll find out somewhere else.
i dont get ur question

wat do u mean by condition in the interface. explain with an example.
 

Owyn

Member
Joined
Feb 1, 2004
Messages
102
Location
Sydney, NSW
Gender
Male
HSC
2006
I'm sorry about that, i think i rushed the question, so i'll try and explain it in more detail. I'm doing a monopoly game, and at the moment when the user hits a button roll it will activate a series of sub programs that will go through all the steps for playing monopoly. The problem i can see will occur when events such as landing on property, where i have it programmed to open a form which would deal with the purchasing of property aspect. There is however coding after the form that realies directly on the results of these forms(not a direct result, but how they change my array of records). What I need is a way of stopping the main form from executing the later commands until the new form has been closed by the user.

This is an example I've taken from my project

If Player(Turn).Jailed > 0 Then frmJail.Show
Call Dice(Dice1, Dice2)
If Player(Turn).Jailed > 0 Then
If Dice1 = Dice2 Then Player(Turn).Jailed = 0
Else
If Dice1 = Dice2 Then
If DoubleCount < 2 Then
Reroll = True
DoubleCount = DoubleCount + 1
Else
DoubleCount = 0
Jail
End If
Else
DoubleCount = 0
End If
End If

Sorry If I showed u too much and confused you, but here i need the user to interact with the Jail form and make a decision before the coding continues, otherwise it doesn't work. Incase it wasn't obvious frmJail would give the user a chance to change the value of Player(Turn).Jailed

I hope that makes it clearier what I'm trying to do. As I was looking for a way to do this i remembered the msgbox function does a similiar process, where the program stops until you've finished interacting with it.
 

J0n

N/A
Joined
Aug 28, 2003
Messages
410
Gender
Male
HSC
2004
You should have said it was a form! ;)
Just change:
frmJail.Show (on line1)
to
frmJail.Show vbModal

(I think that's what you want, right?)
 

Owyn

Member
Joined
Feb 1, 2004
Messages
102
Location
Sydney, NSW
Gender
Male
HSC
2006
Yeh sorry for the confusion, i tryed the vbModal and it worked perfectly, thanks yet again.
 

Kulazzi

Active Member
Joined
Aug 10, 2003
Messages
1,736
Location
Condell Park
Gender
Female
HSC
2005
Originally posted by sunny
Read up on the timer control, and change a picturebox/imagebox's picture when the timer control fires.


Buy it, or ask your school for help.
Apparently our skool doesn't have the program on any resource, they said it comes with the package/system :rolleyes:........and the teacher said we can buy it for a discounted student price.....something like that.....and since it's like a group project, we're all pitching in to buy it...............:)

Originally posted by J0n
To make the time flash, you can just change the .ForeColor propertey of the Label/Textbox you are using to display the time. e.g.

Private Sub Timer1_Timer()
Label1.ForeColor = IIf(Label1.ForeColor = vbBlack, vbRed, vbBlack)
End Sub

You can't download VB 6 free (legally). Although you can download the Control Creation Edition, which has a few limitations such as you can't compile, or you could buy a VB 6 book that has 'VB 6 Working Model Edition' who's only limitation is that you can't compile (there is a registry hack for that on the net ;) ).
Originally posted by Winston
You could also set the visible state of the label every interval from false to true, true to false etc...
Thanx guys fro your suggestions. As with yours Winston, I'm pretty sure i tried that with the teacher but it didn't work but thanx anyways! :) (Our teacher's crap, just leaves us on the computers, does not explain very well :mad1:
 
Last edited:

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
how do we make it so a check box becomes unchecked? ive done the chkbox.value = false, but on the form it still shows that its checked, eventhough its checked, it still wont do anything
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Where are you setting the value?

try:
Code:
checkBox.Value = vbUnchecked
 

velox

Retired
Joined
Mar 19, 2004
Messages
5,521
Location
Where the citi never sleeps.
Gender
Male
HSC
N/A
Private Sub cmdclearbox_Click()
cmblanguage.ListIndex = 0
cmbgreeting.ListIndex = 0
chkitalic.Value = False
chkstrikethru.Value = False
chkbold.Value = False
chkstrikethru.Value = False
chkunderline.Value = False
optCenturyGothic.Value = False
optcomicsans.Value = False
optCenturyGothic.Value = False
optCenturyGothic.Value = vbUnchecked
txtdisplay.Text = ""

End Sub

i have a series of check boxes formatting text in a text box, i want to have a cmdbutton callled "Clear text" to format the font settings back to normal and clear the text box. How would i do this, or am i on the right track, because i tried it for century gothic font, and i typed text in, then pressed cmd clear text and the text was cleared but it didnt go back to the default font( ms sans serif) thanks
 

sunny

meh.
Joined
Jul 7, 2002
Messages
5,350
Gender
Male
HSC
2002
Setting values on checkboxes won't automatically set these values into a textbox. VB doesn't know what you want to do unless you tell it. As far as its concerned, you've only told it to check/uncheck some checkboxes.

You need to set the properties for the textbox for it to work.
 

Owyn

Member
Joined
Feb 1, 2004
Messages
102
Location
Sydney, NSW
Gender
Male
HSC
2006
Hi everyone, that vbModal is working great, however as i put forms and sub's togeather i found that one of the forms is screwing up majorly. After using breakpoints i've worked out that the problem is the form once called originally well perform from load, however after it has been unloaded and called again, it skips form load UNTIL it is unloaded. I think this occurred before i used the vbModal to call it, however since I don't know how vbModal actually works I really have no clue what is causing this problem.

The can be called from various parts of my main code, however everytime it is done:
frmMortgage.Show vbModal

The code used for unloading it is:
If cmdLeave.Caption = "Back" Then Unload frmMortgage
If cmdLeave.Caption = "Continue" Then Unload frmMortgage

Any help would as always be greately appreciated.
 

J0n

N/A
Joined
Aug 28, 2003
Messages
410
Gender
Male
HSC
2004
Originally posted by Owyn
it skips form load UNTIL it is unloaded.
Are you saying that it executes Form_Load, when the form is UNloaded?? What exactly are you doing in Form_Load?
 

Owyn

Member
Joined
Feb 1, 2004
Messages
102
Location
Sydney, NSW
Gender
Male
HSC
2006
Well as far as i can tell when Unload frmMortgage is done it performs formload()

This is the coding for formload, it probabky won't make any sense thoe:

Private Sub Form_Load()
Dim Position As Byte

If Situation = "Upgrade" Then
lblHeading.Caption = "Upgrade Property"
Position = 1
For Index = 1 To 40
If AProperty(Index).Owner = Turn Then
If Monopoly(AProperty(Index).District) = True Then
cmbProperty.List(Position - 1) = AProperty(Index).Name
Position = Position + 1
End If
End If
Next
cmdLeave.Caption = "Back"
Else
lblHeading.Caption = "Mortgage"
Position = 1
For Index = 1 To 40
If AProperty(Index).Owner = Turn Then
cmbProperty.List(Position - 1) = AProperty(Index).Name
Position = Position + 1
End If
Next
If TotalAsset(Turn) < 0 Then
cmdLeave.Caption = "Bankrupt"
Else
If Player(Turn).Cash < 0 Then
cmdLeave.Caption = Continue
cmdLeave.Enabled = False
Else
cmdLeave.Caption = "Back"
End If
End If
End If
lblCash.Caption = Player(Turn).Cash

End Sub

This is the command button code which once clicked is meant to end the form,. After i click this button formload reoccurs, and then it unloads.

Private Sub cmdLeave_Click()

If cmdLeave.Caption = "Back" Then Unload frmMortgage
If cmdLeave.Caption = "Continue" Then Unload frmMortgage
If cmdLeave.Caption = "Bankrupt" Then
Situation = "Bankrupt"
frmMessage.Show vbModal
Player(Turn).Bankrupt = True
For Index = 1 To 40
If AProperty(Index).Owner = Turn Then AProperty(Index).Owner = 0
Next
For Index = 1 To 8
If Player(Index).Bankrupt = False Then
PlayerCount = PlayerCount + 1
If Player(Index).Human = True Then HumanCount = HumanCount + 1
End If
Next
If PlayerCount = 1 Or HumanCount = 0 Then
frmBankrupt.Show vbModal
Unload frmMortgage
End If
End If
End Sub
 

J0n

N/A
Joined
Aug 28, 2003
Messages
410
Gender
Male
HSC
2004
Hmm.. Just a guess, but maybee it is because you are using frmXXX.Show vbModal, and the owner is being set to the form that calls that. What is the name of your main form? What you might try is instead of just using:

frmXXX.Show vbModal

try something like:

frmXXX.Show vbModal, frmMain 'Where frmMain is your main form
 

Owyn

Member
Joined
Feb 1, 2004
Messages
102
Location
Sydney, NSW
Gender
Male
HSC
2006
Didn't seem to fix it, but thanks anyways. I did however fix the problem. Since Unloading it seemed to load it, i just put that before everytime i called it and know it works as if it whered severely screwed up.
 

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Top