hi guys this is probley simple and i have an external board controlling various things on the board is a button which i would like when pressed activates code within a button on my vb form i have tried button1.select but that only well selects the button on my form rather than activate the code

this code is in a timer which scans all 5 pushbuttons on my hardware
[ If ReadDigitalChannel(2) = True Then
Button1.Select()

End If ]

this is the code that the button on my form runs
[ If table1 = False Then
Button1.Text = "Off"
table1 = True
d1 = TimeOfDay
Me.AxForgeLEDc1.Visible = True
Me.AxForgeLEDc1.LEDstate = 1
stats.Label1.Text = TimeOfDay
tbltime.Start()
stats.Button2.Enabled = True
'OpenDevice(0)
SetDigitalChannel(1)
'CloseDevice()

Else

d2 = TimeOfDay
x = d2 - d1
stats.Label2.Text = x.ToString
stats.Label3.Text = Format(elp, "c")
stats.Button2.Enabled = True
stats.Show()
stats.Text = "Stats For Table 1 "

End If ]

i think i have explaned things and added the code correctly

thank you all

Recommended Answers

All 5 Replies

You just type the button's event code in Timer_Tick() event.
When u click on button.
Just type
Timer1.Enable=true
Timer1.interval=200

thanx maya had tried that before and it did work ok perhaps i was just trying to keep codeing to a minimum , so will just go with my initial idead and what you say

thanx again for your prompt reply
tephen

Hi,

You should use the Button.Performclick() event for that instead of select.

thats the one i was looking for thank you so much luc001 ur a star

Hi,

No problem, thank me with the arrow key :)

commented: great person thanx again +3
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.