Let’s say you still use VB.Net. Also, for some reason you notice that your ‘Me’ keyword no longer works (not recognized by intellisense) and that your application startup subroutines errors out and says “Event ‘Startup’ cannot be found”. It sounds really catastrophic, but for me, it wasn’t that big a deal. In the Application button […]
First, let’s start off by explaining what an automatic or auto-implemented property is. Earlier in VB.Net, to create a property, you would need a structure like this: Private _Name As String = “” Public Property Name As String Get return _Name End Get Set(value As String) _Name = value End Set End Property
Let’s say you have a generic list: (VB.Net) Dim ProdList As New List(Of String) With ProdList .Add(“Alice Mutton”) .Add(“Chai”) .Add(“Chang”) .Add(“Gravad lax”) End With (C#) List ProdList = new List(Of, String); ProdList.Add(“Alice Mutton”); ProdList.Add(“Chai”); ProdList.Add(“Chang”); ProdList.Add(“Gravad lax”); Then, let’s say you want to loop through those items, one at a time and manipulate each one […]
With a list type control (DropDownList/RadioButtonList, etc.) – you can dynamically select items in the list with a sort of ‘built-in’ find routine. For instance, if you are retrieving an item from a database, and you want to select that item in your list type control, this is the way to do it.
Here’s the WinForms scenario: You have a listbox which has a context menu. If you try to right-click and item AND choose from the context menu, normal functionality will not choose the item you are actually selecting with your mouse. Normally, you would need to select the item with the left button and then use […]
When you get a warning in your ASP.Net code, it means just what it says. The full error is usually: “Function (YourFunction) doesn’t return a value on all code paths. A null reference exception could occur at run time when the result is used.”
You probably know that, in order to retrieve the currently logged in user in ASP.Net, you would use this code snippet: System.Web.HttpContext.Current.User.Identity.Name() This returns the current user in the DOMAIN\USER format. But sometimes, all you want is the user name itself, without the Domain and slash. Here’s a function you can use to do this:
Knowing the environment variables in your program can sometimes be a very important aspect of your application. It’s very easy to get a list of and to use any one of the environment variables however you need it.
Most people know that, with a string in ASP.net or WinForms development, you can use the replace function to replace certain characters within a string with others. And, you probably know that you can even remove characters alltogether, using the replace function.
The basic concept of displaying data from a database is an essential core concept of ASP.Net. At that core, we have the GridView, which is one of the most used Table-type display devices in ASP.Net Here, we will show the basic code needed to get this accomplished on an ASP.Net web page and since the […]
All Things DotNet Discussed – Winforms/ASP.Net/SharePoint/WPF