Last post Mar 31, 2005 10:55 PM by dnnnew
Mar 31, 2005 03:56 AM|dnnnew|LINK
I am reading Developing Microsoft® ASP.NET Server Controls and Components By
Nikhil Kothari and Vandana Datye.
1) DOES anyone knows if there is a vb.net equivalent of this books code ??
2) What is a event property construct and whats the equivalent of this
PLEASE HELP !!
Mar 31, 2005 07:14 AM|imagemaker|LINK
Although I'm most comfortable programmin in VB, I've learned enough of C# to still get much beneficial instruction from books such as this excellent "bible" for developing custom web server controls. It is constructions such as this one involved in adding
and removing event handlers where VB and C# take much different routes that can be a puzzle and require deeper investigation into C#.
To add and remove handlers in VB:
AddHandler obj.EventName, AddressOf EventHandler RemoveHandler obj.EventName, AddressOf EventHandler
So, in this particular situation:
AddHandler Me.TextChanged, AddressOf EventTextChanged RemoveHandler Me.TextChanged, AddressOf EventTextChanged
Although I have used RemoveHandler often in Windows forms programming, I can't
think of a situation in ASP.NET where it would be used.
Mar 31, 2005 08:15 AM|dnnnew|LINK
Many thanx for the help you hav provided. I do acknowledge that the above book is a great piece of work no doubt about it. I did dig into C# and found out that the above code is a Event Property Construct. On
MSDN i found that Event Property construct are not supported in Visual Basic .Net.
As a developer coming from VB background, can u suggest me a way which will ease my learning of the code of the above mentioned book ??
Mar 31, 2005 09:43 PM|imagemaker|LINK
For now, read the book to learn broad concepts such as the page-life cycle, rendering in composite controls, use of viewstate (particularly how to persist complex properties such as style or collections), and the possible uses of type converters, custom
designers, and custom collection editors. As you study the C# code, you'll usually be able to understand the program flow and be able to easily convert it to VB. When you encounter something like the event property construct that's available in C#, but not
VB, do a Google search or look at some of the tutorials and articles hear or on other sites. If you can't find it there, post the question on either the Getting Started or VB forum here. A quick read through a basic introduction to C# to learn the use of
variable declaration, typecasting, conditional statements, loops, and arrays would also be helpful. I've also done a lot of reading through C# code such as that of these forums to gain ideas of techniques and coding patterns for my own programming.
Thanks to the .NET framework, there really are not that many differences between VB and C#. You happened to come across one of the most puzzling. A couple of other hints you may have already figured out: VB uses < and > to frame class and property attributes
while C# uses [ and ]. VB uses parenthesis to index arrays and collections (including the all important QueryString, Application, Session, and Cache) while C# uses square brackets instead. Also remember that C# is case-sensitive while VB is not.
Mar 31, 2005 10:55 PM|dnnnew|LINK