Seamless Transition: Converting C# to VB.NET with Telerik
In the dynamic world of software development, it's not uncommon to find projects that start in one language and evolve to another. If you're a developer navigating this scenario with C# and VB.NET, and using Telerik UI controls, this guide will help you make a smooth transition.
Understanding the Differences: C# vs VB.NET
Before diving into the conversion process, it's crucial to understand the fundamental differences between C# and VB.NET. C# is a statically-typed language that uses curly braces for blocks, while VB.NET is dynamically-typed and uses indentation and keywords like 'End If' for blocks. This understanding will help you translate your C# code to VB.NET more effectively.
Preparing Your Telerik Controls
Telerik provides extensive support for both C# and VB.NET, making the conversion process smoother. Before you start, ensure you have the latest version of Telerik UI for ASP.NET MVC or Telerik UI for ASP.NET Core, depending on your project. This will ensure you have access to the latest features and improvements.

Converting Simple Controls
Let's start with simple controls like RadButton and RadTextBox. Here's how you can convert them:
C#: RadButton button = new RadButton() { Text = "Click me!" };VB.NET: Dim button As New RadButton() With {.Text = "Click me!"}
Converting More Complex Controls
For more complex controls like RadGrid, you'll need to convert not just the control itself, but also its events and data binding. Here's a simple example:
| C# | VB.NET |
|---|---|
RadGridgrid = new RadGrid<YourType>() { DataSource = yourDataSource };
| Dim grid As New RadGrid(Of YourType)() With {.DataSource = yourDataSource}
|
grid.NeedDataSource += Grid_NeedDataSource;
| AddHandler grid.NeedDataSource, AddressOf Grid_NeedDataSource
|
Converting Events and Delegates
In VB.NET, you use the AddHandler statement to subscribe to events. Here's how you can convert event subscriptions:

C#: button.Click += Button_Click;VB.NET: AddHandler button.Click, AddressOf Button_Click
Leveraging Telerik's Documentation and Community
Telerik provides extensive documentation and a vibrant community for both C# and VB.NET developers. Make sure to leverage these resources to help you with any specific conversions or issues you might encounter.
Remember, the key to a successful conversion is understanding the differences between the languages and taking advantage of the tools and resources available to you. With this guide and Telerik's support, you're well on your way to a seamless transition from C# to VB.NET.






















