nOpe Posted January 22, 2007 at 12:38 AM Report #77723 Posted January 22, 2007 at 12:38 AM Gostaria de activar um botao por codigo em VB.NET... Sei k iss é possivel em vb6 e k fazia assim: (Exemplo) If text1=50 then command1.value=1 end if O problema é k n consigo fazer isto no VB.NET pk n existe o comando VALUE para os botoes... 😛 Kual é o k se deve utilizar? Cumps [[ ]]
Tool Posted January 22, 2007 at 01:00 AM Report #77728 Posted January 22, 2007 at 01:00 AM Não sei se é isto que queres, mas em principio deve haver um "enabled" que activa ou descativa o butão, button.Enabled = True; 😛 Engenharia de Redes e Sistemas Informáticos, DCC-FCUP. www.dcc.fc.up.pt
nOpe Posted January 22, 2007 at 01:05 AM Author Report #77729 Posted January 22, 2007 at 01:05 AM Não sei se é isto que queres, mas em principio deve haver um "enabled" que activa ou descativa o butão, button.Enabled = True; Nepia o enabled é pra deixa ser clikado ou n... n sabs mm mais nd? =\ Cumps [[ ]]
Tool Posted January 22, 2007 at 01:11 AM Report #77731 Posted January 22, 2007 at 01:11 AM hummmm mas o k é k tu entendes por activar? executar a função como se clickasses no butão? Engenharia de Redes e Sistemas Informáticos, DCC-FCUP. www.dcc.fc.up.pt
nOpe Posted January 22, 2007 at 01:12 AM Author Report #77732 Posted January 22, 2007 at 01:12 AM yah exatamente... k o programa clikasse no botao por mim eu no vb6 fazer command1.value=1 e dava mas este n tem VALUE 😛 😄
Tool Posted January 22, 2007 at 01:16 AM Report #77734 Posted January 22, 2007 at 01:16 AM hummm se nao tem nenhuma função na class Button , entao provavelmente tens k chamar a função k activa o butão do tipo: onButton1_click(...) , nao me recordo bem mas normalmente funciona assim lol Engenharia de Redes e Sistemas Informáticos, DCC-FCUP. www.dcc.fc.up.pt
nOpe Posted January 22, 2007 at 01:19 AM Author Report #77735 Posted January 22, 2007 at 01:19 AM pois exatamente e eu fz iss mas tb n deu fiz assim: If textbox1.text = 10 Then Button1_Click(Nothing, Nothing) End If mas n da ta a dar erro... =\ diz isto: Error 13 'WebMail.Form2.Private Sub btnSend_Click(sender As Object, e As System.EventArgs)' is not accessible in this context because it is 'Private'.
Tool Posted January 22, 2007 at 01:28 AM Report #77737 Posted January 22, 2007 at 01:28 AM hummm tas aceder a um metodo privado da class Webmail.form1. a função Button1_Click() pertence a ke class? é pah mas nao existe button1.Button1_Click ou button1.Click? Engenharia de Redes e Sistemas Informáticos, DCC-FCUP. www.dcc.fc.up.pt
nOpe Posted January 22, 2007 at 01:34 AM Author Report #77738 Posted January 22, 2007 at 01:34 AM Epah n ha nd... Ja tentei o comand BUTTON1.SELECT e nd, plos vistos iss funka como um FOCUS pk n carrega no botao só o "ilumina" como selecionado JA tentei o comand BUTTON1.PREFORMCLICK e nd tb.... e das classes n sei... so sei k o botao ta noutr form... o codigo original é este: Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If TextBox1.Text = 20 Then ProgressBar1.Value = ProgressBar1.Value + 10 If ProgressBar1.Value = 100 Then Timer1.Enabled = False Button2.Enabled = True End If If TextBox2.Text = 30 Then [[ Form2.btnSend.Select() ]] --> AKI É K N FUNKA End If End If End Sub n sei pk eles tiraram o command VALUE dos botoes akilo era um espetaculo lol...
nOpe Posted January 22, 2007 at 11:07 AM Author Report #77754 Posted January 22, 2007 at 11:07 AM ng me consegue ajudar com este problema? Cumps [[ ]]
killercode Posted January 22, 2007 at 11:50 AM Report #77757 Posted January 22, 2007 at 11:50 AM vamos la ver se eu entendi bem se o q queres q aconteça é q o valor quando chega a 30, o botão seja clicado automaticamente para executar as funções q estão dentro desse evento, porq não metes o codigo q esta dentro do OnClick dentro de uma função quando clicas no botão chamas essa função e quando o valor é igual a 30 chamas tambem essa função....???? penso q seja isso que pretendes... :smoke: Geek PressWeboeste.Com
Carloz Posted January 22, 2007 at 02:21 PM Report #77778 Posted January 22, 2007 at 02:21 PM pois exatamente e eu fz iss mas tb n deu fiz assim: If textbox1.text = 10 Then Button1_Click(Nothing, Nothing) End If mas n da ta a dar erro... =\ diz isto: Error 13 'WebMail.Form2.Private Sub btnSend_Click(sender As Object, e As System.EventArgs)' is not accessible in this context because it is 'Private'. Tens de mudar a função para Public para que possas aceder à mesma. Quando declaras o "Sub" dizes se é "Private" (privado) ou "Public" (Publico). exemplo: 'Privado Private Sub EXEMPLO() End Sub 'Publico Public Sub EXEMPLO() End Sub "Rejoice not against me, O mine enemy: when I fall, I shall arise; when I sit in darkness, the LORD shall be a light unto me." - Micah 7:8 (KJV)
Icaro Posted January 22, 2007 at 03:11 PM Report #77792 Posted January 22, 2007 at 03:11 PM Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If TextBox1.Text = 50 Then Me.Button1.Focus() SendKeys.Send("{ENTER}") End If End Sub
SoulOnFire Posted January 22, 2007 at 06:24 PM Report #77833 Posted January 22, 2007 at 06:24 PM Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If TextBox1.Text = 50 Then Me.Button1.Focus() SendKeys.Send("{ENTER}") End If End Sub LOL Não é mais facil usar Button1.PerformClick(); Fikem Bem!!!Miguel Duarte - (SoulOnFire)O meu BLOG - XAML E WPF - http://wpfpt.wordpress.com/
Tiago Salgado Posted January 22, 2007 at 08:01 PM Report #77862 Posted January 22, 2007 at 08:01 PM Ou o InvokeOnClick() Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click MessageBox.Show("TESTE") End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Me.InvokeOnClick(Button1, e) End Sub
nOpe Posted January 23, 2007 at 11:07 PM Author Report #78202 Posted January 23, 2007 at 11:07 PM Brigado! Funkou 😉 😛 😄 Usei o codigo do SoulOnFire: Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged If TextBox1.Text = 50 Then Me.Button1.Focus() SendKeys.Send("{ENTER}") End If End Sub O preformClick ja tinha esperimentado e n tava a dar... n sei se era pra essa accao se funkava pra outra cena... sei k n carregou no botao... Cumps e obrigadao pla paciencia [[[ ]]]
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