lewmur Posted November 13, 2005 Share Posted November 13, 2005 I'm trying to convert a VB6 project to 2005 Express and have a problem with the code to execute the code in a command button. In VB6 the code was:Command1.Value = True2005 conversion wizard converted this toCommand1.PerformClick()Sound reasonable but it doesn't work. I put in a "break" to step through the code and when it hits this line it just step through without executing the code in the command button. Quote Link to comment Share on other sites More sharing options...
Marsden11 Posted November 13, 2005 Share Posted November 13, 2005 Me.Command1.PerformClick() Quote Link to comment Share on other sites More sharing options...
lewmur Posted November 13, 2005 Author Share Posted November 13, 2005 (edited) Me.Command1.PerformClick()No. Turns out the command won't exectute unless visable is set to true, even though it is enalbled. Worked fine in VB6. I guess I can move the buttons "off screen" or make them so small they aren't noticeable. Edited November 13, 2005 by lewmur Quote Link to comment Share on other sites More sharing options...
Marsden11 Posted November 14, 2005 Share Posted November 14, 2005 For the 'Click' event, the 'e' parameter contains a reference to 'EventArgs.Empty' by default. Command1_click(nothing,nothing) 'We are passing nothing becasue we dont wantnothing to be passed.If you want to pass some parameters you may do it here.;;;If Not Sender is Nothing then 'do every special thing that is not general for a raiser of this routine.End if;;; Quote Link to comment Share on other sites More sharing options...
lewmur Posted November 14, 2005 Author Share Posted November 14, 2005 (edited) For the 'Click' event, the 'e' parameter contains a reference to 'EventArgs.Empty' by default. Command1_click(nothing,nothing) 'We are passing nothing becasue we dont wantnothing to be passed.If you want to pass some parameters you may do it here.;;;If Not Sender is Nothing then 'do every special thing that is not general for a raiser of this routine.End if;;; ' If myVar is an even number, click Button2. If myVar Mod 2 = 0 Then button2.PerformClick() ' Display the status of Button2's Click event. MessageBox.Show("button2 was clicked ") Else ' Display the status of Button2's Click event. MessageBox.Show("button2 was NOT clicked") End If ' Increment myVar. myVar = myVar + 1 This is the example given by "Help" for the "PerformClick method." Says nothing about any "e" parameter. And as soon as I made the buttons visable, the code executed. However, the button click does already had the "e" and it still didn't work with visible set to false. Public Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Edited November 14, 2005 by lewmur Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.