hi all, newbie wanna ask... :)

if i have a button, normally (before it clicked) the button is just like usual, but if i clicked it, in the button appear dotted line, how if i want to before and after he button clicked without dotted line?

please see the pict, and thanx for the help...button

The only easy way I can think of this is to put another button with the same Caption as the first one over it.

Try it! :-)

i think you should use label in the place of command button .
you can perform almost all task by using label what is performed by a button .
you can write code on label 's click or dblclick an so on . . .

@abelingaw : button over button? can show me how it can be? sorry for my noob...

@rishif2 : any example for me, please?...

setting up a label to click is simple. first delete the button you have, and replace it with a label, you can set the properties so that the background color, border style, etc., allow it to look more like a button. Setup the timer click event code. Then paste your code from the button click event and put it into the label click event. Remeber to handle changing the name of the button in the rest of your code.

Of course there is an even simnpler way. The dotted lines indicate focus. You can easily move the focus to another control, in the first line of the button's click event(i.e. Text1.SetFocus). The control must be one that has a setfocus method, and can accept input, such as a textbox or another button.

drag label control and set its backgrond color , border style , fore color and so on . now it will look like a button and it also execute codes on its click , dblclick event .

hope this helps you

@rishif2 and @tinstaafl : if i use a label, how can i perform it like a real button, when it clicked, it just like a pushed button and release after clicked?

@tinstaafl : is it possible to remove focus without moving it to another control?

I can't see any other way to remove the focus.

You could try this code snippet to make a label look like a button, sort of. Start with the apperance flat, and the border fixed single. It doesn't start raised but when you click it it will push in.

Private Sub Label1_Click()
    Label1.Appearance = 0
End Sub

Private Sub Label1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Appearance = 1
End Sub

Is the button a Microsoft Forms 2.0 Object Library CommandButton that has a TakeFocusOnClick property? If so, try setting the property to false.

sorry for long time no feedback from me, cause my unwell body :(

@tinstaafl : thanx for the code, it's lok like button, but IMO, it's not as sensitive as real button (may be it's just my feeling).

@TnTinMN : i don't think so, it just ordinary button, is it any different beetwen ordinary button and from Microsoft Forms 2.0 Object Library?

Yes it doesn't behave like a true button, just one option though. Using the button from the forms 2.0 library, will do what you want. It's basically the same with a few added properties.

just add component(Microsot Forms 2.0 Object Library) and it will provide a command button which is something different from ordinary command button

after adding and designing button on the form you have to set one property which can also be accessible through the code , and it is as follow

Private Sub Form_Load()
Me.CommandButton1.TakeFocusOnClick = False
End Sub

you can set this property through property window also.

and if you dont know how to add components then do followings ...

just press ctrl+t , it will open a dialog box which allows you to add more components to your project and now here find "Microsot Forms 2.0 Object Library" and add it .

hope this solves your problem.

yesss... this is what i want!!!

@tinstaafl, @rishif2 and all: thanks for your help, i just need Microsot Forms 2.0 Object Library like you say, and of course your code, rishif2 :)

Thanks...

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.