What's new

VB6 Question

Olger901

Banned
another vb6 question

I am making an options screen for 1 of my programs.

Now I got a button and when I press it it needs to change an option in a certain line in the code. How would I do this??

Thanks for all the answers
 

Niggy G

HTAFC will rise again!!!
I am making an options screen for 1 of my programs.

Now I got a button and when I press it it needs to change an option in a certain line in the code. How would I do this??

Im not exactly sure what your asking for here, could you be a little more specific....

Ive read some of your previous posts and i think you understand VB basics so i don't see what your problem would be with using an IF statement. Alternatively write another sub that is called when you click your button.

I don't think ive been much help here sorry... :plain:
 
OP
O

Olger901

Banned
I want to change an option which is in the Code of my program by pressing a button I want change a line in the VB code what would that command be and the option can only be changed within the code
 

Niggy G

HTAFC will rise again!!!
...and the option can only be changed within the code...


You can't change the actual code at run time (which is when the button would be pressed) but you can run different code depending on weather or not you press the button.

Im still having trouble understanding what exactly you want to do, attatch you VB prog...
 

Eagle

aka Alshain
Moderator
Sorry, been gone all Thanksgiving break, but I'm having trouble understanding you too. My guess is what you want is a simple if then else statement. Assuming your using an option button or a check box...

Code:
If option1.value= true then

...

Else

...

End If

And Niggy G is right, no language will allow you to change code during runtime, its just not sensible to do so. It would make your code virtually unreadable or untraceable by a human. If you were thinking of doing it when a command button is pressed down, then I have to ask... why? For most program settings you want to use one of three objects, an option button, a check box, or a checkable menu item, I cant see any reason you would want to use anything else, however it is possible with a command button if you still think you want to. All you need to do is change the text or picture or something and then test it.

Code:
If command1.caption = "Enable X Option" then

...
command1.caption = "Disable X Option"

Else

...
command1.caption = "Enable X Option"

End If
 
Last edited:

Top