cjard
Well-known member
- Joined
- Apr 25, 2006
- Messages
- 7,081
- Programming Experience
- 10+
OK< maybe I've been spoiled, but in C#, if I want to handle the MyDataTableRowChanging event, I can write in the form's constructor:
A tooltip appears at this point, suggesting something like:
new MyRowChangeEventHandler( [PRESS TAB TO INSERT]
I press Tab
at this point, another suggestion appears:
My_RowChange [PRESS TAB TO INSERT]
I press Tab, and a new sub is created to handle this event..
Our code in the constructor ends up something like:
How do we do this in VB? I want the IDE to write the signature for me, and put in the handler..
Update: ok, so here's a way I deem rather lame, but I cant find a significantly easier way:
Then with the compiler error:
Method 'Private Sub xy()' cannot handle Event 'Public Event MyRowChanging(sender As Object, e As App1.MyDataSet.MyDataTable.ContactRowChangeEvent)' because they do not have the same signature.
copy the bold bit, and paste it in as the handler.
This just strikes me as being a mess. Maybe I could AddHandler() it, but why is the IDE so unhelpful?
VB.NET:
this.MyDataSet.MyDataTable.MyRowChanging +=
A tooltip appears at this point, suggesting something like:
new MyRowChangeEventHandler( [PRESS TAB TO INSERT]
I press Tab
at this point, another suggestion appears:
My_RowChange [PRESS TAB TO INSERT]
I press Tab, and a new sub is created to handle this event..
Our code in the constructor ends up something like:
VB.NET:
this.MyDataSet.MyDataTable.MyRowChanging += new MyRowChangeEventHandler(My_RowChange)
}
public void My_RowChange(Object sender, RowChangeEventArgs e){
//TODO: add your event handler code here
}
How do we do this in VB? I want the IDE to write the signature for me, and put in the handler..
Update: ok, so here's a way I deem rather lame, but I cant find a significantly easier way:
VB.NET:
Public Form blah
Private WithEvents x As MyDataSet.MyDataTable = Me.MyDataSet.MyDataTable
Private xy() Handles x.MyRowChanging
Then with the compiler error:
Method 'Private Sub xy()' cannot handle Event 'Public Event MyRowChanging(sender As Object, e As App1.MyDataSet.MyDataTable.ContactRowChangeEvent)' because they do not have the same signature.
copy the bold bit, and paste it in as the handler.
This just strikes me as being a mess. Maybe I could AddHandler() it, but why is the IDE so unhelpful?
Last edited: