Click here to Skip to main content
15,917,610 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionDrag-and-Drop in VB.NET Pin
jacobjordan5-Aug-08 6:48
jacobjordan5-Aug-08 6:48 
AnswerRe: Drag-and-Drop in VB.NET Pin
Bassam Saoud5-Aug-08 6:54
Bassam Saoud5-Aug-08 6:54 
QuestionEnumeration - Public enum statement question Pin
chas0365-Aug-08 4:11
chas0365-Aug-08 4:11 
AnswerRe: Enumeration - Public enum statement question Pin
jzonthemtn5-Aug-08 4:21
jzonthemtn5-Aug-08 4:21 
GeneralRe: Enumeration - Public enum statement question Pin
Oakman5-Aug-08 7:34
Oakman5-Aug-08 7:34 
GeneralRe: Enumeration - Public enum statement question Pin
jzonthemtn5-Aug-08 7:49
jzonthemtn5-Aug-08 7:49 
GeneralRe: Enumeration - Public enum statement question Pin
MidwestLimey5-Aug-08 12:12
professionalMidwestLimey5-Aug-08 12:12 
QuestionHelp understanding C# to VB.Net translation of event handlers... Need C# and VB.Net expert... Pin
Keith Yerian5-Aug-08 3:24
Keith Yerian5-Aug-08 3:24 
I am trying to use a C# example of a usercontrol to write a VB.Net usercontrol with some simular features. My first step was to convert a C# control to VB.Net. I love this example (a newly written wizard control) and am trying to design a multi-pane control based using this control as an example of the right way to do things. However... I am not understanding the following code...

public delegate void ItemChangingHandler(int index, GenericChangeEventArgs<t> e);

public event ItemChangingHandler Changing;

protected override void OnSet(int index, object oldValue, object newValue)
{
GenericChangeEventArgs<T> e = new GenericChangeEventArgs<T>((T)oldValue, (T)newValue);
if (Changing != null)
{
Changing(index, e);
if (e.Cancel)
{
return;
}
}
base.OnSet(index, oldValue, newValue);
}

What does If (Changing != null) really do. If I translate this to VB.Net I get

Protected Overloads Overrides Sub OnSet(ByVal index As Integer, ByVal oldValue As Object, ByVal newValue As Object)
Dim e As New GenericChangeEventArgs(Of T)(DirectCast(oldValue, T), DirectCast(newValue, T))
If Changing IsNot Nothing Then
RaiseEvent Changing(index, e)
If e.Cancel Then Exit Sub
End If
MyBase.OnSet(index, oldValue, newValue)
End Sub ' (ByVal index As Integer, ByVal oldValue As Object, ByVal newValue As Object)

Where the line "If Changing IsNot Nothing Then" generates a compiler error...
Error 1 'Public Event Changing(index As Integer, e As GenericChangeEventArgs(Of T))' is an event, and cannot be called directly. Use a 'RaiseEvent' statement to raise an event. C:\My Projects\VB.Net\etc\ezWizard\ezWizard\Collection\GenericCollection.vb 347 10 ezWizard

I would greatly appriciate any help anyone could give me. Anyone understand C# and VB.Net?


Keith Alan Yerian

Keith Alan Yerian

AnswerRe: Help understanding C# to VB.Net translation of event handlers... Need C# and VB.Net expert... Pin
Dave Doknjas5-Aug-08 5:04
Dave Doknjas5-Aug-08 5:04 
AnswerRe: Help understanding C# to VB.Net translation of event handlers... Need C# and VB.Net expert... Pin
paas5-Aug-08 5:05
paas5-Aug-08 5:05 
QuestionHow to merge cells of table control Pin
Rameez Raja5-Aug-08 0:58
Rameez Raja5-Aug-08 0:58 
AnswerRe: How to merge cells of table control Pin
John_Adams5-Aug-08 3:02
John_Adams5-Aug-08 3:02 
QuestionI think it's wrong Pin
abuamd5-Aug-08 0:29
abuamd5-Aug-08 0:29 
AnswerRe: I think it's wrong Pin
Ashfield5-Aug-08 1:20
Ashfield5-Aug-08 1:20 
GeneralRe: I think it's wrong Pin
abuamd6-Aug-08 2:39
abuamd6-Aug-08 2:39 
AnswerRe: I think it's wrong Pin
rprateek5-Aug-08 16:02
rprateek5-Aug-08 16:02 
GeneralRe: I think it's wrong Pin
abuamd6-Aug-08 2:42
abuamd6-Aug-08 2:42 
QuestionPublish property in Web service Pin
nitin_ion5-Aug-08 0:24
nitin_ion5-Aug-08 0:24 
AnswerRe: Publish property in Web service Pin
Mycroft Holmes5-Aug-08 21:52
professionalMycroft Holmes5-Aug-08 21:52 
QuestionUpdation of Software (vb.net 2005) Pin
compad5-Aug-08 0:07
compad5-Aug-08 0:07 
AnswerRe: Updation of Software (vb.net 2005) Pin
Vimalsoft(Pty) Ltd5-Aug-08 0:30
professionalVimalsoft(Pty) Ltd5-Aug-08 0:30 
GeneralRe: Updation of Software (vb.net 2005) Pin
compad5-Aug-08 22:51
compad5-Aug-08 22:51 
AnswerRe: Updation of Software (vb.net 2005) Pin
jzonthemtn5-Aug-08 2:01
jzonthemtn5-Aug-08 2:01 
GeneralRe: Updation of Software (vb.net 2005) Pin
compad5-Aug-08 22:58
compad5-Aug-08 22:58 
QuestionVB.Net Pin
mutharasi5-Aug-08 0:00
mutharasi5-Aug-08 0:00 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.