|
-
May 18th, 2007, 08:44 AM
#1
Thread Starter
Fanatic Member
[RESOLVED] Raise Events ?
I am trying to run a sub procedure from within the form load event.
In VB6 I would have simply written the subs name and it would of executed and then come back to the next line in the form load event.
In .net I get a message saying use the raise events method, I have looked at the raise events method help and its not helpful.
How do I write the line of code?
-
May 18th, 2007, 09:28 AM
#2
Frenzied Member
Re: Raise Events ?
Hi,
what exactly does your code read in the form_load event
Pete
-
May 18th, 2007, 10:32 AM
#3
Thread Starter
Fanatic Member
Re: Raise Events ?
Code:
Dim Type As String
Type = Get_From_Config_File("Data")
If Type = "D2" Then
RadioButton8.Checked = True
End if
This is the code in question, I then want the RadioButton8_CheckedChanged event to fire which I thought it would have done any way but it does not. I therefore changed the code to
Code:
Dim Type As String
Type = Get_From_Config_File("Data")
If Type = "D2" Then
RadioButton8.Checked = True
RadioButton8.CheckedChanged()
Endif
Which is when I get the error described above
-
May 18th, 2007, 10:47 AM
#4
Frenzied Member
Re: Raise Events ?
Hi,
you can use RadioButton8_CheckChanged(Me, system.eventargs.empty) to make the event fire, but simply setting the checked value to true will make it fire - I have just checked it out.
Are you sure 'Type' contains D2 - I suspect it doesn't
Pete
-
May 18th, 2007, 01:43 PM
#5
Thread Starter
Fanatic Member
Re: Raise Events ?
Pete
This is the Sub I would like to fire when my If then Else statement is true
Code:
Private Sub RadioButton8_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RadioButton8.CheckedChanged
The 'Type' does contain “D2” and when I currently step throught the code it runs the line RadioButton8.Checked = True and then goes to the end if. It does not change the checked value and then run the sub I have included above.
If I put in your line RadioButton8_CheckChanged(Me, system.eventargs.empty) then I get an error that says name "RadioButton8_CheckChanged" is not declared 
Post Note:
RadioButton8_CheckedChanged(Me, System.EventArgs.Empty) does fire the sub, so I am now working on that line of coding and will report back later
Last edited by JohnSavage; May 18th, 2007 at 01:51 PM.
-
May 18th, 2007, 02:25 PM
#6
Thread Starter
Fanatic Member
Re: Raise Events ?
Pete
It looks like your last idea has done it for me and all is working well. It’s strange that the checked changed event does not fire when the “check is Changed” using code but who am I to question .NET.
Many thanks again without your input I would still be wondering if I was the only one that used this board.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|