vb.net

Embed XML element in inline VB code

Consider the following code in VB9: Dim text = "Line1<br/>Line2" Dim markup = <span><%= text %></span>.ToString While I was hoping markup would end up being <span>Line1<br/>Line2</span>, it actually evaluates to <span>Line1&lt;br/&gt;Line2</span>. Is there any way to get the value of the variable not to be HTML encoded? P.S.: This i...

Add Your Own Custom Namespace to the My Namespace in VB.Net

I know how to add methods to the MY namesapce, but what I'd like to do is create my own namespaces. For example. My.Nation.State.City.Restraunt or whatever. ...

Typed DataSet connection - required to have one in the .xsd file?

In the .xsd file for a typed DataSet in .NET, there's a <Connections> section that contains a list of any data connections I've used to set up the DataTables and TableAdapters. There are times when I'd prefer not to have those there. For instance, sometimes I prefer to pass in a connection string to a custom constructor and use that ra...

Dyanamically added control not doing postback

I am overriding a Grid, adding some customer features. One of the features is a drop-down to adjust page size. I am extending the grid using a customer server control, which works great for what I've done so far. Now, however I am having a bit of trouble getting the dynamically added control to do a postback. The javascript to initia...

When extending a asp.net web control, at which event should additional web controls be injected?

I'm trying to avoid a composite control or using and ASCX by extending an existing control. However, I'm having trouble with getting the controls added to the inherited control and keep their view-state/post-back integrity. Whenever I add the controls during pre-render, the controls show up, but the post-back throws a viewstate exception...

Adding handlers to Dynamically Created Context Menu

I need to populate a context menu from a database at run time. I do not know the number of items that will be in the list, so I would like to handle the click event in a single place. How do I declare the handler so I can tell which menu item actually triggered the click. Thanks, Dave Public Function GetBookmarkContextMenu(ByVal aBo...

Line Break in TextBox or Html Area

Hi, What is the way of seperating Line-Breaks and Space in MultiLine Textbox or Html Text are while inserting database(Asp.Net).Forexample what should i do if i want to insert Hello World to database with line breaks?And Also While displaying what should i do too?i dont want to use Editor for it. Thanks for ur Help ...

Are There Easy Ways To Print Data on Specific Area

I'd like to print some data to specific area on A4 paper. Are there any easy way to do like that? It's very difficult for me to find coordinate of X and Y. Below is my sample code in VB.NET to print the data. Private Sub PrintDocument1_PrintPage(ByVal sender As Object, ByVal e As System.Drawing.Printing.PrintPageEventArgs) Handles Print...

How to implement transaction way in vb.net?

Hi, I develop one application using VB.net (200%) that connects to MS-Access Database, I use TableAdapter and Dataset for connection to the Access DB file. I need to implement a simple transaction method (commit, rollback) in saving to the DB? Is there a way to do that without the need to use inline SQL statement? Thanks, ...

How can a hashtable be bound to a drop down list?

In vb.net / winforms, how can a hashtable be bound to a drop down list or any other datasource-driven control? ...

Invalid Cast during Input

I'm doing a basic homework assignment which looks like this: While input <> -1 input = CDbl(InputBox("Enter numbers to add, enter -1 to stop")) values = values + input End While It works fine until I press 'cancel' on the input box. Then the string input is "", and I get the following error: System.InvalidCas...

How do I unit test object serialization/deserialization in VB.NET 1.1?

I am looking for example code that provides a unit test to serialize and deserialize an object from a memory stream. I have found examples using C# 2.0, however my current project uses VB.NET 1.1 (don't ask me why...), so the solution can not use generics. I am also using the NUnit framework for the unit tests. Thanks! ...

Refactor menu item for VB.NET projects in VS2008

Is there any way to use the VS2008 built-in Refactoring functionality on VB.NET projects? ...

Getting name of file copied to clipboard from email attachment in VB.NET

If a user copies a file to the clipboard in Windows from an Outlook email attachment, is there any way I can get the name of that file in VB.NET? If the file is copied from Windows Explorer, Clipboard.GetFileDropList has data that I can use to get this, but that list is empty when the file is copied from an email attachment (there are ...

WCF Server/Client connection handling

Hi everyone, I'm having some problems with my WCF server and client connections. If I use my service and client normally, meaning my client connects and disconnects thru normal operations (myclient.Close()) everything works fine. But in the instance that I have the server running and I use the visual studio "Stop" button to exit my cl...

Get the startup path in a vb.net console exe

How do get the startup path ( system.windows.forms.application.StartupPath ) of my exe without adding a reference to system.windows.forms? ...

What is the system type for a byte array - asp.net?

I need to use a byte array as a profile property in a website. Normally I would declare the type as system.string or system.int32 but I have no idea what the type if for a byte array. EDIT: I need to use this as profile property that is declared in the web.config like below: <profile defaultProvider="ProfileProvider" enabled="true"> ...

Why Dictionary is preferred over hashtable in C#?

In most of programming languages, we preferred using a dictionary over a hashtable . What are the reasons behind it? ...

ASP.NET MVC Storefront VB Port? LazyList in particular

Hi, I am using Rob Connery's excellent MVC Storefront as a loose basis for my new MVC Web App but I'm having trouble porting the LazyList code to VB.NET (don't ask). It seems that VB doesn't allow the GetEnumerator function to be specified twice with only differing return types. Does anyone know how I might get around this? Thanks Pr...

Exception when casting from concrete class to interface in LINQ query.

Hi, I have a class SomeClass, which can populate itself from a datarow in it's constructor. This class implements IInterface. However, when I execute the code below: Dim fpQuery As IEnumerable(Of IInterface) = _ From dr As DataRow In DataLayer.SomeMethodToGetADataTable.AsEnumerable _ Select New SomeClass(dr) I get the error ...