vb.net

Handling exceptions within custom Functions

All of us use the try catch blocks. But what is the best way of handling errors within custom functions? Display a messagebox to the user when the exception is thrown (if possible within the function), or return a value indicating that an error was found within the function? ...

Network Folder Security

Hi, I have a treeview control which is being used to browse various folder on the users system drive. It can also be set up to connect network folders using UNC paths e.g "\server\files". At the moment I'm getting a list of Directories by using My.Computer.FileSystem.GetDirectories however this obviously fails when the folder is passw...

9-Slice Images in WPF

I was wondering if anyone knew how to duplicate the 9-slice functionality of Flex/Flash in WPF and VB.Net. I have used 9-slice scaling many times in Flex and it would be a great asset in WPF. I would like to be able to have an image as my background of a Canvas and have it stretch without ruining the rounded corners. Please, does anyone ...

Getting static field values of a type using reflection

I've got a set of static "enumeration" classes that I'm using to hold meaningful variable names to represent meaningless code values I receive on an input file. Here's an example of one. Public Class ReasonCodeValue Private Sub New() End Sub Public Shared ReadOnly ServiceNotCovered As String = "SNCV" Public Shared ReadOn...

Show Header/Footer when Gridview is Blank VB.net

I realise there is a solution for this but I am struggling to get it to convert to VB correctly :( I have managed to get a cascading set of dropdowns with data based upon each others results which I was really pleased with. However due to the post back the grid will disappear until the second value is selected and looks awful Is there...

Conversion of VB6 HTTP request to VB.Net 2.0

I'm attempting to update a legacy VB6 component (not written by me) to the .NET platform. There is one function which posts an XML string to a URL: Function PostToUrl(ByRef psUrl, ByRef psData, Byref psResponseText, ByRef psErrorMsg, ByRef psUsername, ByRef psPassword) On Error Resume Next Dim objWinHTTP PostToUrl = False psError...

Session Variable Member?

I'm using a compiled .dll provided by someone else -- I know little about it, other than it has a session variable that I must access in a way that is strange to me. Not sure what to call it -- have googled for words that I thought might be right, but so far no success. Here is what it looks like: Session("receipt").username It's the...

Changing the Connection String of LINQ dmbl programmaticaly

I have two seperate databases, one is production the other is test. Before LINQ, I could simply change the connection string to swtich db's. However, the string is read only, and I have no way to change the string. How can I change the Connection String programmatically? Edited for Clarity Im using my.settings to store all of this inf...

How to call a com+ component?

Hi, I'm making some archeology, dealing with COM+ I managed to enlist a simple COM dll as a COM+ component, so far so good. So I've got this 'foobar' com+ component, with it's interface, and the method I'd like to call. My question is then rally simple: how am I supposed to make a call to this component? Any .NET or VB6 answer is ac...

Bluetooth hotspots

Where should you start when your next application was a bluetooth hotspot implementation? Any help (link, e-book, guide) would be gratefully appreciated ...

Send parameter to addhandler?

I have a button in a grid that I created programmatically. The button edits some data in a table using data in a hidden column of the grid that the button is in. Normally I send a hidden field the row data using javascript onclientclick of the button then make the changes to the database using that hidden field. But there must be a way t...

How do I read a text file on the same server with ASP.NET?

Solution: It turns out I wasn't checking the path that it was looking up, quite silly of me. Once I tracked that problem down and corrected the offending path, the reading worked just fine. Still baffled at the MSSQL issue, since the articles average less than 10 000 bytes. Clarification: I am unsure if some of you are under the imp...

vb.net Module for data access - how bad is this?

I've inherited some code that has a Public Module for data access: Code looks like: Public Module Foo Dim ds As New DataSet Public Function GetDataSet(ByVal sqlQuery As String) As DataSet ... Fill(ds)... ... return ds End Function End Module And all the pages call GetDataSet(sql). Am I correct is as...

What happens if you close a SqlConnection before the SqlDataReader?

What would happen if you call Close() on a SqlConnection object before you call Close() on a SqlDataReader using that connection? Actually, what I really want to know is whether or not the order in which you Close them matters. Does calling SqlConnection.Close() completely close the connection, or will it remain open if you do not call...

Where to go next with training

About 10 years ago I had a good, on track career in IT programming C++/VB and SQL Server, however made several bad carrer desisions and ended up going backwards, developing in MS Access and a little VB. About a year ago I got lucky and managed to move to a company doing .NET development. I am really enjoying it, got a fairly good grasp o...

Add empty value to a DropDownList in ASP.net MVC

I'm building a data entry interface and have successfully bound the columns that have reference tables for their data using DropDownList so the user selects from the pre-configured values. My problem now is that I don't want the first value to be selected by default, I need to force the user to select a value from the list to avoid erro...

Why not have OnXXX event raiser methods return a value?

Say you have an event raiser method (OnXXX) that raises an event using the CancelEventArgs class is there anything wrong with having the OnXXX method return the value of e.Cancel? For example: Public Sub ProcessFiles(folder as DirectoryInfo) For each file in folder.GetFiles() If OnProcessingFile(New FileEventArgs(file)) Th...

What is The Recommended Architecture for ASP.NET Web Applications?

In the first comment (by J.W.) to this question: Using ObjectDataSource and DataObjectTypeName, How Do You Handle Delete Methods With Just An Id Parameter?, it is said that using ObjectDataSource is a bad design. What is considered good design for well-architected ASP.NET applications? ...

How to define the RouteTable in VB.NET ?

[Route Table 1][1] This image shows how to define the RouteTable in C#, using the Route Class. How to define it in VB.NET? ...

Vba - On error doesn't work? Reading registry value

Hi, this is strange, I've got a macro with an array containing several registry keys. And I want to insert the values of these into predefined bookmarks in a Word document. This works great if the key is there, but if it isn't, I want the code to skip that and continue trying the next one in the array. I've got the code that looks l...