hi evryone.

i really dont get it. i want to put keyboard shortcuts on the button i have other than clicking this buttons. but the problem is i dont know how. i tried putting an ampersand (&) sign before the text of the buttons and it work, but the ampersand sign also displays. heres the original code:

Button1.Text = Mid(ChoosenWord, PickedSeq(0), 1)
        Button2.Text = Mid(ChoosenWord, PickedSeq(1), 1)
        Button3.Text = Mid(ChoosenWord, PickedSeq(2), 1)
        Button4.Text = Mid(ChoosenWord, PickedSeq(3), 1)
        Button5.Text = Mid(ChoosenWord, PickedSeq(4), 1)

and this is what i did:

Button1.Text = "&" & Mid(ChoosenWord, PickedSeq(0), 1)
        Button2.Text = "&" & Mid(ChoosenWord, PickedSeq(1), 1)
        Button3.Text = "&" & Mid(ChoosenWord, PickedSeq(2), 1)
        Button4.Text = "&" & Mid(ChoosenWord, PickedSeq(3), 1)
        Button5.Text = "&" & Mid(ChoosenWord, PickedSeq(4), 1)

the text of this buttons is only one character from the string "ChoosenWord" with a character of "PickedSeq()". so if ChoosenWord contains "this" and the character is PickedSeq(0), then the text of the button is "t".

Can someone plese help me? thanks in advance.

Recommended Answers

All 5 Replies

I tried the same thing with this code: Button1.Text = "&" & "ButtonTest" - and it worked.
I wonder if the problem has something to do with the mid part of your code. What if you built a string variable first, like:

Word2 =  "&" & Mid(ChoosenWord, PickedSeq(1), 1)
Button2.text = "&" & Word2

Just grasping at straws here...

I tried the same thing with this code: Button1.Text = "&" & "ButtonTest" - and it worked.
I wonder if the problem has something to do with the mid part of your code. What if you built a string variable first, like:

Word2 =  "&" & Mid(ChoosenWord, PickedSeq(1), 1)
Button2.text = "&" & Word2

Just grasping at straws here...

ok. ill try it. hope it works. thanks

Word2 =  "&" & Mid(ChoosenWord, PickedSeq(1), 1)
            Button2.text = "&" & Word2

this didnt work. same results with what i did. the ampersand (&) also displays. have any idea? please. help me.

Word2 =  "&" & Mid(ChoosenWord, PickedSeq(1), 1)
            Button2.text = "&" & Word2

this didnt work. same results with what i did. the ampersand (&) also displays. have any idea? please. help me.

Sorry - nothing is clicking for me on this one. Need to bring in the big guns. I suggest you repost the problems with a different title -
"Generating a keyboard shortcut at runtime" might get some other attention.
Good Luck.

First of all you should check that " UseMnemonic "(Form property) is true,therefore you would not have problem with emerging & in your form..
GOOD LUCK...

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.