vb.net

Using the same asp panel in multiple tabs

In the Ajax toolkit you can use a Tab Container and add TabPanels to this. I have some controls that I want to be able to use across all tabs and the tailor the tabs with other controls as neccessary. My question is how do I reuse a panel on multiple tabs? Essentially I after something like this <TabContainer> <tabPanel1> <contentT...

How do you inherit StringBuilder in vb.net?

I want to add my own member to the StringBuilder class, but when I go to create it IntelliSense doesn't bring it up. public class myStringBuilder() Inherits System.Text.[StringBuilder should be here] .... end class Is it even possible? thanks ...

How to associate all textbox controls on a form with the same event handler

VB 2008. I have several text boxes on a form and I want each of them to use the same event handler. I know how to manually wire each one up to the handler, but I'm looking for a more generic way so if I add more text boxes they will automatically be hooked up to the event handler. Ideas? EDIT: Using the C# sample from MusiGenesis (and...

Why is LINQ to SQL converting my string parameter to a column name?

This Linq to SQL query ... Return (From t In Db.Concessions Where t.Country = "ga" Select t.ConcessionID, t.Title, t.Country) ... is generating this SQL: SELECT [t0].[ConcessionID], [t0].[Title], [t0].[Country] FROM [dbo].[Concessions] AS [t0] WHERE [t0].[Country] = ga ... when what I want is WHERE [t0].[Country] = 'ga' Any ...

XML Serialization, No Whitespace

I have the following serialization method: Private Function SerializeData(ByVal data As cData) As String If data IsNot Nothing Then Dim xml_stream As New MemoryStream() Dim sr As StreamReader Dim xs As New XmlSerializer(GetType(cData)) xml_stream = New MemoryStream() ...

Create Generic List from a subclass

Option Explicit On Option Strict On Public Class Class1 Dim l As List(Of A) Public Sub New() l = New List(Of B) End Sub End Class Public Class A End Class Public Class B Inherits A End Class<p> I've run into this problem. I have a list declared of a Generic Type 'A' I want to define the list as a Generic T...

Bold text for a tab control

I'd like to bold the text for a tab page under certain conditions (not, necessarily, GotFocus). Is it true the only 'er easiest way to do this is by overriding the DrawItem event for the tab control? http://www.vbforums.com/showthread.php?t=355093 It seems like there should be an easier way. Like ... tabControl.TabPages(index).Fo...

C# equivalent to VB.NET Catch ... When

In VB.NET I often Catch ... When ... Try ' Some code' Catch e As ArgumentNullException When e.ParamName.ToUpper() = "SAMPLES" ' Handle the error' End Try Is there a C# equivalent to Catch ... When? I don't want to resort to using an if statement inside a catch if possible. ...

Help refactor function that takes lots of arguments.

Hi all, I was wondering if anyone would be able to help me refactor some code that I wrote a while ago. I wrote a wrapper for a COM object that only excepted strings as input, so in good OOP practice I wrapped the string up in a function so that it was easier to build and call. I was just wondering if anyone could think of a better w...

How to databind a property within a property

I cureently have a set up like below Public ClassA property _classB as ClassB End Class Public ClassB property _someProperty as someProperty End Class what I want to do is to databind object A to a gridview with one of the columns being databound to ClassB._someProperty. When I try to databind it as Classb._someProperty I ge...

Visual Print Design for .NET

I have a project that I'm working on and I need to be able to print out ID cards from the program. Are there any products out there that are reasonably priced so I can design a document for print and use it in .NET? I'm trying to avoid using System.Drawing from having to do it manually because when the company I work for needs to make ch...

Odd exception thrown in .NET

Exception Thrown: "System.ComponentModel.ReflectPropertyDescriptor is not marked as Serializable" Does this mean I missed marking something as serializable myself, or is this something beyond my control? ...

Serializable Inheritance

If something inherits from a Serializable class, is the child class still Serializable? ...

ListBox retains posted value even after being databound

Please note that the problem described below is almost the exact opposite to the common problem of "my control shows the same value every time the page loads. I understand the behavior expressed is generally not desirable. I have a listbox which is being databound in the page load event even on postback. When the event handler for the...

Is there any kind of file dependency tracer for Asp.Net apps?

I have an Asp.Net 2.0 (VB.Net) app and I'm trying to export a Control (ASCX) to another project. I need to know what other files that the Control needs in order to work. Is there any way - using VS.Net 2005 or an external app - to recursively trace the dependencies of a page or control in a solution? For example, for this file: ~/Cont...

How do I cope with rounding errors on doubles in vb.net?

I'm trying to balance a set of currency values using vb.net. The totals for both these values is cast as a double. I'm getting rounding errors in some situations. What's the best way to avoid this? Is there a type I can use in preference to double? How do I round the resultant value to two decimal places? Here's my code - I probably d...

LinqtoSQL and problems

I am using link to sql, I have a connected set of objects. I start out and do a linq statement like this Dim L= from II in context.InventoryItems select II Dim L2 = L.tolist The second line was so that I could narrow down where the problem was occuring. When the second line is hit I get an error "The EntitySet is already loaded and t...

What are the reasons for these 2 error messages?

First of all, I'd like to say that this site is great! My question is, what are the reasons for the following 2 error messages? 1) In VB.NET (I know this is a C# forum but my next question is from C# experience), property evaluation failed (I do this when putting a watch on an exception variable). 2) In C#, method or class (Can't reme...

Adding click event to button to fire javascript, through VB.NET

Hi, I have an ASP.NET page which pulls a set of images from a database table, and using an enumerator, goes through all of them and displays then. This all happens in the codebehind (VB.NET), where the code adds the placeholder and some controls inside tables (tables inside the placeholder). I've added a button to this placeholder (in...

Visual Studio 2008 - Application closes when unhandled exception occurs.

I have a problem when an unhandeld exception occurs while debugging a WinForm VB.NET project. The problem is that my application terminates and I have to start the application again, instead of retrying the action as was the case in VS2003 The unhandeld exception is implemented in the new My.MyApplication class found in ApplicationEven...