Senior Posted November 30, 2009 at 08:42 PM Report Share #298114 Posted November 30, 2009 at 08:42 PM viva tenho mais uma duvida simples como e que fazo em vez de carregar num botao carrego na tecla enter? Link to comment Share on other sites More sharing options...
ribeiro55 Posted November 30, 2009 at 09:12 PM Report Share #298120 Posted November 30, 2009 at 09:12 PM Depende da aplicação. Qual é o âmbito? Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
Senior Posted November 30, 2009 at 10:18 PM Author Report Share #298145 Posted November 30, 2009 at 10:18 PM é um search engine Link to comment Share on other sites More sharing options...
ribeiro55 Posted November 30, 2009 at 10:28 PM Report Share #298152 Posted November 30, 2009 at 10:28 PM Deduzi que fosse algo do género... mas... a partir de onde? Uma textbox? Private Sub TextBox1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles TextBox1.KeyPress If e.KeyChar = Chr(Keys.Enter) Then Button1_Click(Nothing, Nothing) End Sub Onde o Button1_Click é o handler do Button1.Click (o que é automáticamente gerado quando dás 2 cliques no botão, em "design time") Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
jpaulino Posted November 30, 2009 at 10:36 PM Report Share #298156 Posted November 30, 2009 at 10:36 PM Segundo o exemplo do riberio55, também podes fazer: Button1.PerformClick() em vez de Button1_Click(Nothing, Nothing) Mas assim também funciona 🙂 Link to comment Share on other sites More sharing options...
ribeiro55 Posted November 30, 2009 at 10:38 PM Report Share #298157 Posted November 30, 2009 at 10:38 PM Eu prefiro chamar o sub. Já tive uma má experiência com o PerformClick. Não a consegui reproduzir desde então, mas fiquei escaldado 🙂 Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
jpaulino Posted November 30, 2009 at 10:56 PM Report Share #298162 Posted November 30, 2009 at 10:56 PM Eu prefiro chamar o sub.Já tive uma má experiência com o PerformClick. Não a consegui reproduzir desde então, mas fiquei escaldado Se fizeres PerformClick() a um botão numa ToolStrip, por exemplo, ele faz o efeito de pressionar o botão, o que não fica muito agradável visualmente. Tirando isso funciona bem 🙂 Link to comment Share on other sites More sharing options...
Johnny Posted December 12, 2009 at 08:11 PM Report Share #300070 Posted December 12, 2009 at 08:11 PM Pessoal, estou a postar aqui para n abrir um topico novo... sabem qual o codigo para associar ao "+", "-", "*" e "/"? tipo: If e.KeyChar = Chr(Keys.+) Then Button1_Click(Nothing, Nothing) End Sub é assim? Link to comment Share on other sites More sharing options...
ribeiro55 Posted December 12, 2009 at 11:39 PM Report Share #300108 Posted December 12, 2009 at 11:39 PM Mas tens mesmo de abrir um novo tópico. Ninguém se lembra de ver qual o código para o +, -, etcetc num tópico de nome: "Utilizar enter" Sérgio Ribeiro "Great coders aren't born. They're compiled and released""Expert coders do not need a keyboard. They just throw magnets at the RAM chips" Link to comment Share on other sites More sharing options...
renafi Posted December 13, 2009 at 02:11 PM Report Share #300149 Posted December 13, 2009 at 02:11 PM Senior, se estiveres a trabalhar em Windows Forms, tens uma propriedade na form, que é o AcceptButton, associas o botão que terá a acção que queres, e está feito. Eu acho que é isto que queres. Oracle Certified Professional - AdministraçãoOracle Certified Professional - Pl/sqlMCPD - Microsoft Certified Professional DeveloperMCTS - Microsoft Certified Technology Specialist Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now