Skip to main content

Posts

Showing posts with the label language-vbnet

Adjusting Notepad++ to work with an ASP VBScript project.

I have a large project in classic ASP, VBScript, and Javascript. It’s a hassle dealing with it because developer tools don’t support it that well or at all. I recently poked around the open source editor Notepad++ and got it adjusted to work decently well with the project. Check out Notepad++ on the official website here . In the past I had used Eclipse with an old VBScript ASP syntax highlighter. It wasn’t perfect, but worked alright overall. The main issue is that the highlighting stopped working every so often, and not to mention Eclipse is bulky and a pain to use for various reasons. Here is a screenshot of Notepad++ adjusted to work with the project: Here are my main adjustments: “View” >> “Folder as Workspace” “View” >> “Document Map” “View” >> “Function List” “Settings” >> “Preferences…” >> “Editing” >> “Display line number” The function list feature won’t work without modification. My project is broken into a large number of “.asp” files and ...

Grids and ASP.NET (vb)

Manually filling rows of data in ASP.NET controls can be a bit unintuitive. I’ll go over a few things I learned recently. I’m writing up this posting off the top of my head, so I can’t say for certain the code examples are correct in syntax. Use the template field in your grid view as it’s the most flexible to deal with as apposed to using asp bind field tags or other means. <asp:TemplateField HeaderText="A Column"> <ItemTemplate> <a href="http://address"><%# Bind("dbField") %></a> </ItemTemplate> </asp:TemplateField> The example above is a column template field with the Bind() function call. Bind() is a special function that can be used to link data that the template field has access to within the grid row. You can also use Eval() which just prints the data and does not hard link the control and data like Bind() does. Also take note of the # in the asp tags <%# %> this is shorthand for...

Short-circuit conditionals in VB.NET

I’m in a situation now where I am required to write programming code in VB.NET. Which brings me up to a simple programming construct that I came upon by writing code like I would in C#, but getting a different expected result in VB.NET. In C#, using the && operator in conditionals is *by default* a short-circuit type conditional. That means when the first term is evaluated, the additional statements won’t be processed at all if that first statement was not true. The main benefit is something like this: Say, you want to check a listbox for specific values… if(lb1.selectedIndex > -1 && lb1.selectedValue.compare(“value text”) == true) { code to run } If the list box has no list items in there (eg. a selectedIndex of -1), the second condition will never be checked. If C# did not short circuit after the first term resulted in false, a program error would occur because the second condition would not have anything set for the selectedValue property. Oddly enough, in VB...

VB.NET is a pleasure

I started using VB.NET to write that JSON/FTP/site editor program. I found a free ready made library to work with the JSON data. It’s from Newtonsoft Really easy to use. They don’t have much documentation, but just looking through the library with IntelliSense in the VB IDE is more than enough to understand how to use it. With around 6 lines of code I can flip data between CLR objects and JSON. Very nice! I used VB.NET 2003 version about a year ago for the final group project in the last computer class I had. It didn’t seem as easy to use as the 2005 express version I am using now. It’s probably because that was my first foray into using .NET… anyways. A a quick term list: CLR = common language runtime JSON = JavaScript object notation IDE = integrated development environment FTP = file transfer protocol VB = Visual Basic programming language (.NET version) IntelliSense = One of the ways Microsoft makes coding easier in the IDE.