Visual Basic help please

Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
lol jaffa cake, thanks mate i appreciate it.

But im in college now and no msn on here and they won't let us connect to the wireless network. Oh and i'm handing this in today :rolleyes:

All i want is for the class selection to be displayed on the output form but the code i used doesnt seem to work here is the exact code from the drop down combo box which is located on form1 (input form) and i want the slection to be displayed on the output form (form2).

Private Sub Class_Change()
class.additem "Class 1"
class.additem "Class 2"
class.additem "Class 3"
form2.lblclassout.Caption = class.text
End Sub
 
Associate
Joined
9 Oct 2006
Posts
1,945
Location
Location Location!
Is the Sub actually being started?

MsgBox("Debugging") at the top of the sub and see if you get it.

I been trying your code but its not starting for me.

Edit: I added the same code to the _Click and _KeyPress events and it works for me.
 
Last edited:
Associate
OP
Joined
11 Nov 2006
Posts
549
Location
Devon
I'm not sure what you mean i have add MsgBox ("Debugging") at the top of my Sub but that doesn't seem to help.

I thought by using a combo menu (as kindly advised by shadez) it would allow me to get away with not using an error message as the user can only select the correct options. But getting the slection to display is proving to be a pain in the .....
 
Associate
Joined
9 Oct 2006
Posts
1,945
Location
Location Location!
shadow4509 said:
I'm not sure what you mean i have add MsgBox ("Debugging") at the top of my Sub but that doesn't seem to help.

I thought by using a combo menu (as kindly advised by shadez) it would allow me to get away with not using an error message as the user can only select the correct options. But getting the slection to display is proving to be a pain in the .....

Sorry if I didn't explain it properly.

I'm trying your code and when I change the value of the combo box then the Private "Sub Class_Change()" does not actually start.
By adding "MsgBox("Started sub!")" under "Private Sub Class_Change()" then you can see if the sub is actually starting when you change the value of the combo box. As far as I can tell its not starting because your code is correct.

If it doesn't start then you need to try adding 2 new subs

Code:
Private Sub Class_Click()
form2.lblclassout.Caption = class.text
End Sub

Private Sub Class_KeyPress(KeyAscii As Integer)
form2.lblclassout.Caption = class.text
End Sub
form2.lblclassout.Caption = class.text
 
Associate
Joined
9 Oct 2006
Posts
1,945
Location
Location Location!
shadow4509 said:
Yeah jaffa cake i love you!!!!

Lol i just added the first sub you posted and that has got it working. Would you recommened still adding the second sub?

The KeyPress one is incase the user changes the value of the combo box by pressing the up/down arrow key. Click is if its changed by clicking it... obviously.

I would add both but its up to you.
 
Back
Top Bottom