The Student Room Group
Reply 1
Command.Caption
if you look at the toolbar where u can change the characteristics of each of the components u use in a vb project. for example command buttons, text boxes etc u can see how each of the characterstics is labelled. It is a little confusing at firsrt because as u tried below value is not the correct one for command buttons but caption is sometimes, for example wtih text boxes u would have to use textbox.text to change the content of the textbox... or something like that is a long time since i programmed vb.

anyway consult the toolbar as it gives clues as to how u mite go about changing other characterstics of the objects as well :biggrin: have fun
Reply 3
Sorry i don't think i made what i was asking help about clear enough.

I needed to know what the code was for to say If the command button was executed. Is there an equivalent to:

IF Command1.executed Then
[INDENT]Command2.Caption = "Available"[/INDENT]

obviously executed isnt the correct characteristic, i just dont know how else to write it.
Reply 4
Go into design view and double click Command1. This will sort out the onclick for you. So you'll just have to do:

Command2.Caption = "Available"

Surely you should have come across this in CPT3?
Reply 5
For CPT3 we used access, no VB at all.

My problem was more complicated than just using the click event of the command button. Ive sorted it now though, thanks anyway.

there were about 20 command buttons on the first form to input the different appointments to the database. what i wanted to do was say if the first command button had been pressed it, the command would change the corresponding command caption to available.

I sorted it with using a hidden text box that on click of the first command entered the name of the command button to the text box and then use select case to check which command button to change the caption of, i couldnt think of any simpler ways but it works.
Reply 6
Aah right, I forgot that you didnt have to use VB in CPT3...Glad you got it working.
kk im probably making a total ****** of myself feel free to say if i am :biggrin: but surely if u want to rewrite wats on the command button name u just have to put:

Private Sub CommandButton1_Click()
CommandButton1.Caption = "hello"
End Sub

if the command buttom is pressed then the capition, the name of the command button cahnges to hello

thats prob not wat u wanted to do bt i thought it was from ur ppost :frown: nevamind otherwise
Reply 8
andy_cole2
kk im probably making a total ****** of myself feel free to say if i am :biggrin: but surely if u want to rewrite wats on the command button name u just have to put:

Private Sub CommandButton1_Click()
CommandButton1.Caption = "hello"
End Sub

if the command buttom is pressed then the capition, the name of the command button cahnges to hello

thats prob not wat u wanted to do bt i thought it was from ur ppost :frown: nevamind otherwise


Thats exactly what I thought he wanted. Apart from it changes CommandButton2. Strange.
it seems weird because i have never been taught vb but something like this is really easy to do its just logic :s-smilie: lol i dunno maybe it is wat he wanted or maybe not. i mean if it was really wat he was after then you could have it change the title of all the command buttons on that one click...oh the possibilities:p:

Latest

Trending

Trending